npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pin-encryptor

v1.1.2

Published

pin encryption tool

Downloads

10

Readme

pin-encryptor

npm

npm i pin-encryptor

https://en.wikipedia.org/wiki/ISO_9564

To protect the PIN during transmission from the PIN entry device to the verifier, the standard requires that the PIN be encrypted, and specifies several formats that may be used.

The PIN block formats are:

Format 0

The PIN block is constructed by XOR-ing two 64-bit fields: the plain text PIN field and the account number field, both of which comprise 16 four-bit nibbles (16-digit hex).

The plain text PIN field is:

  • one nibble with the value of 0, which identifies this as a format 0 block
  • one nibble encoding the length N of the PIN
  • N nibbles, each encoding one PIN digit
  • 14−N nibbles, each holding the "fill" value 15 (i.e. 11112)

The account number field is:

  • four nibbles with the value of zero
  • 12 nibbles containing the right-most 12 digits of the primary account number (PAN), excluding the check digit
import { PinEncryptor } from 'pin-encryptor';

const p = PinEncryptor.format0('1529', '123456789177');
console.log(p, p.length);   // 041528dcba9876e8 16

Format 1

This format should be used where no Account number is available. The PIN block is constructed by concatenating the PIN with a transaction number thus:

  • one nibble with the value of 1, which identifies this as a format 1 block
  • one nibble encoding the length N of the PIN
  • N nibbles, each encoding one PIN digit
  • 14−N nibbles encoding a unique value, which may be a transaction sequence number, time stamp or random number
import { PinEncryptor } from 'pin-encryptor';

const p = PinEncryptor.format1('1529', '123456789177');
console.log(p, p.length);   // 1415291234567891 16

Format 2

Format 2 is for local use with off-line systems only, e.g. smart cards. The PIN block is constructed by concatenating the PIN with a filler value thus:

  • one nibble with the value of 2, which identifies this as a format 2 block
  • one nibble encoding the length N of the PIN
  • N nibbles, each encoding one PIN digit
  • 14−N nibbles, each holding the "fill" value 15 (i.e. 11112) (Except for the format value in the first nibble, this is identical to the plain text PIN field of format 0.)
import { PinEncryptor } from 'pin-encryptor';

const p = PinEncryptor.format2('1529');
console.log(p, p.length);   // 241529FFFFFFFFFF 16

Format 3

Format 3 is the same as format 0, except that the "fill" digits are random values from 10 to 15, and the first nibble (which identifies the block format) has the value 3.

import { PinEncryptor } from 'pin-encryptor';

const p = PinEncryptor.format3('1529');
console.log(p, p.length);   // 341529DFBADABBFC 16

https://wesomething.com/