9
与包hashids,我可以从数字散列(编码和解码Ÿ)得到的字符串散列,像hashids
var Hashids = require("hashids"),
hashids = new Hashids("this is my salt", 8);
var id = hashids.encode(1);
存在一些类似的包获取哈希从字符串? (带编码/解码)
与包hashids,我可以从数字散列(编码和解码Ÿ)得到的字符串散列,像hashids
var Hashids = require("hashids"),
hashids = new Hashids("this is my salt", 8);
var id = hashids.encode(1);
存在一些类似的包获取哈希从字符串? (带编码/解码)
var Hashids = require("hashids");
var hashids = new Hashids("this is my salt");
var hex = Buffer('Hello World').toString('hex');
console.log (hex); // '48656c6c6f20576f726c64'
var encoded = hashids.encodeHex(hex);
console.log (encoded); // 'rZ4pPgYxegCarB3eXbg'
var decodedHex = hashids.decodeHex('rZ4pPgYxegCarB3eXbg');
console.log (decodedHex); // '48656c6c6f20576f726c64'
var string = Buffer('48656c6c6f20576f726c64', 'hex').toString('utf8');
console.log (string); // 'Hello World'
Buffer?我在哪里可以找到它?谢谢! – Eusthace 2017-05-02 00:54:21
https://nodejs.org/api/buffer.html – 2017-06-28 13:34:55
客户端?浏览器... :) – Eusthace 2017-06-28 22:50:07