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 dataconstdata0=_modex.encode('5834b135dc124d38c');// encode bufferconstmybuffer=Buffer.from('5834b135dc124d38c','hex');constdata1=_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 hexconstdata0=_modex.encode('iijbeetrkrtlghuddhdhhjdej');// decode modhex to bufferconstdata1=_modhex.encode('iijbeetrkrtlghuddhdhhjdej','buffer');Please open a new issue on GitHub
modhex is OpenSource and licensed under the Terms of The MIT License