Exemple #1
0
 /** This method does not use a checksum, the returned data must be validated some other way.
     @arg {string} cipher - hex
     @return {string} binary (could easily be readable text)
 */
 decryptHex(cipher) {
     assert(cipher, "Missing cipher text");
     // Convert data into word arrays (used by Crypto)
     var cipher_array = encHex.parse(cipher);
     var plainwords = this._decrypt_word_array(cipher_array);
     return encHex.stringify(plainwords);
 }
Exemple #2
0
 /** @arg {string} hash - A 128 byte hex string, typically one would call {@link fromSeed} instead. */
 static fromSha512(hash) {
     assert.equal(hash.length, 128, `A Sha512 in HEX should be 128 characters long, instead got ${hash.length}`);
     var iv = encHex.parse(hash.substring(64, 96));
     var key = encHex.parse(hash.substring(0, 64));
     return new Aes(iv, key);
 };
Exemple #3
0
 /** This method does not use a checksum, the returned data must be validated some other way.
     @arg {string} plainhex - hex format
     @return {String} hex
 */
 encryptHex(plainhex) {
     var plain_array = encHex.parse(plainhex);
     var cipher_array = this._encrypt_word_array(plain_array);
     return encHex.stringify(cipher_array);
 }