Base64, Hashes, Encryption
Webhook Relay provides a helper package to deal with various hashing and cryptography related operations.
Encoding and decoding base64 data
When base64 encoding is needed, import crypto
package:
To decode some value:
Create MD5 hash
To create MD5 message-digest algorithm based hashes:
Note: MD5 is considered cryptographically broken, if you can, use SHA256 hashing algorithm.
Create SHA1, SHA256, SHA512 hashes
SHA-2 (Secure Hash Algorithm 2) hashing functions are provided by the crypto
package:
Calculating HMAC
HMAC can be calculated using MD5, SHA1, SHA256 and SHA512 algorithms combined with the data and the key. It may be used to simultaneously verify both the data integrity and the authenticity of a message.
Method hmac
takes three parameters:
Algorithm, valid values: md5, sha1, sha256, sha512
Data to verify
Secret key in a string form (not base64 encoded)
Calculating CRC32 checksum
CRC32 is an error-detecting code commonly used to detect accidental changes to raw data. It computes the CRC-32 checksum using the IEEE polynomial.
Last updated