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 
 

猜你喜欢

转载自blog.csdn.net/pan_xi_yi/article/details/83504331