modhex encoding/decoding used by Yubico-OTP Authentication
yarn add modhex --save
- Encode Data to modhex
- Decode modhex Strings
Description: Encode Data to modhex
Syntax: data:ModhexString = encode(data:HexString|Buffer)
Arguments:
- data:HexString|Buffer - Input data as hex-String or Buffer
Example:
const _modex = require('modhex');
// encode hex data
const data0 = _modex.encode('5834b135dc124d38c');
// encode buffer
const mybuffer = Buffer.from('5834b135dc124d38c', 'hex');
const data1 = _modhex.encode(mybuffer);
Description: Decode modhex Strings
Syntax: data:HexString|Buffer = decode(data:ModhexString, [encoding:String])
Arguments:
- data:ModhexString - Input data as modhex
- encoding:String(optional) - Output encoding {hex, buffer} default: hex
Example:
const _modex = require('modhex');
// decode modhex data to hex
const data0 = _modex.encode('iijbeetrkrtlghuddhdhhjdej');
// decode modhex to buffer
const data1 = _modhex.encode('iijbeetrkrtlghuddhdhhjdej', 'buffer');
Please open a new issue on GitHub
modhex is OpenSource and licensed under the Terms of The MIT License