crypto
crypto module
Encryption algorithm module
crypto module is a encryption module in FIBOS which supports the encryption algorithm such as SHA1, SHA256, SHA512, it can be used directly in js contract.
Static Function
recover_key
Recover public key from given hash and signature.
1 | crypto.recover_key(digest,signature); |
Parameter Usage:
- digest: String, Hash result from given message.
- signature: String, given signature.
Results:
- String, return the recovered public key
Example:
1 | exports.hi1 = sig => { |
sha1
Create a SHA1 information digest operation object
1 | crypto.sha1(data); |
Parameter Usage:
- data: Buffer, Create while updating binary data.
Results:
- String, Return the hex encoded string for the result of the information digest
Example:
1 | exports.hi = v => { |
sha256
Create a SHA256 Information digest operation object
1 | crypto.sha256(data); |
Parameter Usage:
- data: Buffer, Create while updating binary data.
Results: - String, Return the hex encoded string for the result of the information digest
Example:
1 | exports.hi = v => { |
sha512
Create a SHA512 Information digest operation object
1 | crypto.sha512(data); |
Parameter Usage:
- data: Buffer, Create while updating binary data.
Results:
- String, Return the hex encoded string for the result of the information digest
Example:
1 | exports.hi = v => { |
ripemd160
Create a RIPEMD160 Information digest operation object
1 | crypto.ripemd160(data); |
Parameter Usage:
- data: Buffer, Create while updating binary data.
Results:
- String, Return the hex encoded string for the result of the information digest
Example:
1 | exports.hi = v => { |
