crypto-js#lib TypeScript Examples
The following examples show how to use
crypto-js#lib.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: password-encoder.ts From malagu with MIT License | 6 votes |
async encode(rawPassword: string): Promise<string> {
const { encodeHashAsBase64 } = this.options;
const salt = lib.WordArray.random(8);
const encoded = this.doEncode(rawPassword, salt.toString());
if (encodeHashAsBase64) {
return enc.Base64.stringify(enc.Utf8.parse(encoded));
}
return encoded;
}
Example #2
Source File: base64-string-key-generator.ts From malagu with MIT License | 5 votes |
async generateKey(keyLength?: number) {
const key = lib.WordArray.random(keyLength || this.keyLength);
return enc.Base64.stringify(key);
}