複雑な家庭の事情でどうしてもfirebase上のアプリで任意の値をMD5にしなければならなかったのでメモ。
nuxt上でなんか処理しようかとおもったがいいライブラリがなく、CloudFunctionsならNode.jsなのでcryptoモジュールが使えることに気づいた。
/functions/index.js
const crypto = require('crypto');
const hash_ni_shitai_value = "ハッシュ化したい値";
const hash_ni_natta_value = crypto.createHash('md5').update(hash_ni_shitai_value).digest('hex');
return hash_ni_natta_value;
phpのmd5($str)
ほど短くはないけどこれが最短なのでは。