com.b3dgs.lionengine.utility
Class Checksum

java.lang.Object
  extended by com.b3dgs.lionengine.utility.Checksum

public class Checksum
extends java.lang.Object

SHA-256 based checksum manipulation.


Constructor Summary
Checksum()
          Create a new checksum.
 
Method Summary
 java.lang.String getSHA1(java.lang.String str)
          Get the SHA-256 signature of the input string.
 java.lang.String getSHA256(byte[] bytes)
          Get the SHA-256 signature of the input bytes.
 java.lang.String getSHA256(int i)
          Get the SHA-256 signature of the input integer.
 boolean valid(java.lang.String value, java.lang.String signature)
          Compare a checksum with its supposed original value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Checksum

public Checksum()
Create a new checksum.

Method Detail

valid

public boolean valid(java.lang.String value,
                     java.lang.String signature)
Compare a checksum with its supposed original value.

Parameters:
value - original value.
signature - checksum value.
Returns:
true if corresponding (checksum of value is equal to its signature).

getSHA256

public java.lang.String getSHA256(byte[] bytes)
Get the SHA-256 signature of the input bytes.

Parameters:
bytes - input bytes.
Returns:
bytes signature.

getSHA256

public java.lang.String getSHA256(int i)
Get the SHA-256 signature of the input integer.

Parameters:
i - input integer.
Returns:
integer signature.

getSHA1

public java.lang.String getSHA1(java.lang.String str)
Get the SHA-256 signature of the input string.

Parameters:
str - input integer.
Returns:
string signature.