本文整理汇总了TypeScript中ts-md5/dist/md5.Md5.hashStr方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Md5.hashStr方法的具体用法?TypeScript Md5.hashStr怎么用?TypeScript Md5.hashStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ts-md5/dist/md5.Md5
的用法示例。
在下文中一共展示了Md5.hashStr方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getGravatar
getGravatar(email, size) {
let gravUrl;
let color;
if(email) {
let size = size || 80;
gravUrl = 'http://www.gravatar.com/avatar/' +Md5.hashStr(email) + '?s=' + size;
} else {
console.log(COLORS);
color = this.randomizeArray(COLORS)[0];
}
return Promise.resolve({url: gravUrl, color: color})
}
示例2: transform
transform(email, args) {
let store = new Store(new CookieService());
let settings = store.getValue('user-settings');
if (settings !== null) {
for (let i = 0; i < settings.length; i++) {
let setting = settings[i];
if (setting.name === email) {
return setting.img;
}
}
}
let baseUrl = 'http://www.gravatar.com/avatar/';
let hash = Md5.hashStr(email.trim().toLowerCase(), false);
return baseUrl + hash;
}
示例3: login
login(event, username, password) {
event.preventDefault();
password = Md5.hashStr(password);
let body = JSON.stringify({ username, password });
this.http.post('http://localhost:3001/sessions/create', body, { headers: contentHeaders })
.subscribe(
response => {
debugger;
localStorage.setItem('id_token', response.json().id_token);
localStorage.setItem('id_usr', response.json().id);
this.router.navigate(['events']);
},
error => {
alert(error.text());
console.log(error.text());
}
);
}
示例4: getMd5Token
private getMd5Token(timeStamp: number): string {
let token = String(md5.Md5.hashStr(SITE_SALT + String(timeStamp) + this.password));
return token;
}
示例5: createHash
function createHash(ts, privkey, pubkey) {
const preHash = ts + privkey + pubkey;
return Md5.hashStr(preHash);
}
示例6: ngOnInit
ngOnInit() {
this.logger.info('ionViewDidLoad GravatarPage');
if (typeof this.email === "string") {
this.emailHash = Md5.hashStr(this.email.toLowerCase() || '');
}
}
示例7: getGravatarUrl
public getGravatarUrl() {
const email = this.editForm.get('email').value || '';
return `https://www.gravatar.com/avatar/${Md5.hashStr(email)}?s=80&d=retro`;
}