本文整理汇总了TypeScript中jssha.getHash函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getHash函数的具体用法?TypeScript getHash怎么用?TypeScript getHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getHash函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
/// <reference types="node" />
var imported = require("jssha");
var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8");
var shaObj2 = new imported("This is a Test", "TEXT");
var hash1:string = shaObj2.getHash("SHA-512", "HEX");
var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2);
var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"});
var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"};
var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX");
var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format);
示例2: ngOnInit
ngOnInit(): void {
let shaObj = new jsSHA("SHA-512", "TEXT");
shaObj.update("This is a test");
this.hash = shaObj.getHash("HEX");
}
示例3: plaintextToDigest
private plaintextToDigest(pass) {
var shaObj = new jsSHA("SHA-256", "TEXT");
shaObj.update(pass);
return shaObj.getHash("HEX");
};
示例4: getSha1
private getSha1(text:string) {
let shaObj = new jssha(text, 'TEXT');
return shaObj.getHash( 'SHA-1', 'B64');
}