LoginSignup
3
1

More than 5 years have passed since last update.

【TypeScript】シンプルなMD5変換方法

Last updated at Posted at 2017-08-18

Node.jsでのMD5の変換を調べてみたら、cryptoという標準ライブラリがあったのですが、
https://nodejs.org/api/crypto.html#crypto_crypto

もっと簡単なライブラリがあったので、記事にしてみました。

NPM

$ npm install md5 --save
$ npm install @types/md5 --save

使い方

DefinitelyTypedのテストコードを参考にするとわかりやすい
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/md5/md5-tests.ts

md5の使い方
import * as md5 from 'md5';

const message = 'hoge'
console.log(md5(message));

なんとシンプル!!

3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1