Skip to content

Repository files navigation

Binary Encoding for QR Codes

Installation

bun add @dimipay/bqencode
# or
npm install @dimipay/bqencode

Base 10

encode 7 bytes to 17 characters.

import{base10}from"bqencode";constbuf=Buffer.from('b7c6aa3984e5b440df5eba71879c95b834','hex');constenc=base10.encode(buf);console.log(enc);// '517283551498008841825999645740431609812020'constdec=base10.decode(enc)console.log(dec.toString('hex'));// 'b7c6aa3984e5b440df5eba71879c95b834'

Base 45

encode 2 bytes to 3 characters.

import{base45}from"bqencode";constbuf=Buffer.from('b7c6aa3984e5b440df5eba71879c95b834','hex');constenc=base45.encode(buf);console.log(enc);// 'LANHNL1 GJZMWASTPNL6HX-I71'constdec=base45.decode(enc)console.log(dec.toString('hex'));// 'b7c6aa3984e5b440df5eba71879c95b834'

Base 94

eocode 4 bytes to 5 characters.

import{base94}from"bqencode";constbuf=Buffer.from('b7c6aa3984e5b440df5eba71879c95b834','hex');constenc=base94.encode(buf);console.log(enc);// 'Fq.OHU[IU=P@w~POP9.>U!'constdec=base94.decode(enc)console.log(dec.toString('hex'));// 'b7c6aa3984e5b440df5eba71879c95b834'

About

encoding for binary QR code

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages