Crypto

Sometimes doing cryptographic operations can be useful in a Cript. Cripts provides a foundation for such tasks, providing hashing, encryption and encoding/decoding.

注釈

This is still very much work in progress, and thus far we've only added the most basic of cryptographic operations. More will be added as needed.

Hash

Object

Description

cripts::Crypto::MD5

MD5 hashing.

cripts::Crypto::SHA256

SHA256 hashing.

cripts::Crypto::SHA512

SHA512 hashing.

cripts::Crypto::HMAC::SHA256

HMAC-SHA256 hashing.

These objects all provide a Encode() and Decode() method, to hash and unhash strings. Examples:

do_remap()
{
  CDebug("SHA256 = {}", cripts::Crypto::SHA256::Encode("Hello World"));
}

Encryption

Currently only one encryption object is provides, for AES256. This object provides Encrypt() and Decrypt() methods. A Hex() method is also provided to retrieve the encrypted data as a hex string. For encrypting data in chunks, a Finalize() method is provided to retrieve the final encrypted data.

Object

Description

cripts::Crypto::AES256

AES256 encryption and decryption.

Encoding

Finally, for convenience, Cripts provides a Base64 object for encoding and decoding, as well as a URL escaping object, Escape.

Object

Description

cripts::Crypto::Base64

Methods for Base64 encoding.

cripts::Crypto::Escape

Methods for URL escaping.

These objects all provide a Encode() and Decode() method, to encode and decode strings.