-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the Cryptum wiki,
a simple and fast set of cryptographic tools.
Cryptum makes it really easy to encrypt or decrypt a string of text, in order to keep your information secret and secure.
- MD5
- SHA-1
- SHA-224
- SHA-256
- SHA-384
- SHA-512
- SHA-3
- RIPEMD-160
Notes:
— SHA-512 is identical to SHA-256 but operates on 64-bit words rather than 32. SHA-224 and SHA-384 are largely identical but truncated versions of SHA-256 and SHA-512 respectively.
— SHA-3 is the winner of a five-year competition to select a new cryptographic hash algorithm where 64 competing designs were evaluated; it should be named Keccak[c=2d]: each of the SHA-3 functions is based on an instance of the Keccak algorithm, which NIST selected as the winner of the SHA-3 competition (learn more), but those SHA-3 functions won't produce hashes identical to Keccak.
The keyed-hash message authentication codes is a mechanism for message authentication using cryptographic hash functions. HMAC can be used in combination with any iterated cryptographic hash function and its cryptographic strength depends on the properties of the underlying hash function. [learn more]
var hashMD5 = Cryptum.HmacMD5("text", "secret_passphrase");
var hashSHA512 = Cryptum.HmacSHA512("text", "secret_passphrase");
It is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually cannot be used directly as a cryptographic key, some processing is required. A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack. [learn more]
var salt = Cryptum.lib.WordArray.random(128/8);
var key128bits = Cryptum.PBKDF2("secret_passphrase", salt, {keySize: 128/32});
var key256bits = Cryptum.PBKDF2("secret_passphrase", salt, {keySize: 256/32});
var key512bits = Cryptum.PBKDF2("secret_passphrase", salt, {keySize: 512/32});
var key512bits1000iterations = Cryptum.PBKDF2("secret_passphrase", salt, {keySize: 512/32, iterations: 1000});
- AES
- DES
- Triple DES
- Rabbit
- RC4
- RC4Drop
Notes:
— AES-128, AES-192 and AES-256 are supported. The variant will be picked by the size of the key passed in. If a passphrase is used, then it will be generated a 256-bit key.
— DES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS). DES is now considered to be insecure due to the small key size: TripleDES applies DES three times to each block to increase the key size. The algorithm is believed to be secure in this form.
— RC4 is a widely-used stream cipher, used in popular protocols such as SSL and WEP. The algorithm's history does not inspire confidence in its security: it was discovered that the first few bytes of keystream are strongly non-random and leak information about the key. For this reason the initial portion of the keystream has to be discarded. The so-modified algorithm is traditionally called RC4-drop. By default, 192 words (768 bytes) are dropped, but is possible to configure the algorithm to drop any number of words.
var key = Cryptum.enc.Hex.parse('000102030405060708090a0b0c0d0e0f');
var iv = Cryptum.enc.Hex.parse('101112131415161718191a1b1c1d1e1f');
var encrypted = Cryptum.AES.encrypt("text", key, {iv: iv});
var encrypted = Cryptum.AES.encrypt("text", "secret_passphrase", {
mode: Cryptum.mode.CFB,
padding: Cryptum.pad.AnsiX923
});
modes | padding schemes |
---|---|
CBC (default), CFB, CTR, OFB, ECB |
Pkcs7 (default), Iso97971, AnsiX923, Iso10126, ZeroPadding, NoPadding |
var utf8 = Cryptum.enc.Utf8;
var encrypted = Cryptum.TripleDES.encrypt("text", "secret_passphrase").toString();
var decrypted = Cryptum.TripleDES.decrypt("U2FsdGVkX19gij3jYU5uolpbVpRfvl/s", "secret_passphrase").toString();
console.log(encrypted); // prints "U2FsdGVkX19gij3jYU5uolpbVpRfvl/s"
console.log(decrypted); // prints "74657874"
var encoded = Cryptum.TripleDES.decrypt("U2FsdGVkX19gij3jYU5uolpbVpRfvl/s", "secret_passphrase").toString(utf8);
console.log(encoded); // prints "text"
–––
Andrea Leone