1. 程式人生 > >angular 中使用md5加密

angular 中使用md5加密

安裝 ts-md5

npm install ts-md5 --save

在需要使用的component或者service中 import
import {Md5} from 'ts-md5/dist/md5';

使用Md5中的 hashStr方法
原始碼

static hashStr(str: string, raw?: boolean): Int32Array | string;
比如
let password:string = '123123';
 
Md5.hashStr(password);
結果 : 4297f44b13955235245b2497399d7a93

原文:https://blog.csdn.net/qq_34438958/article/details/72792977