PIN encoding monster – protect your sheets

#include <stdio.h>
#include <stdlib.h>

The pin encoding monster. Encrypts and generates
lists of numeric pin codes using simple over- and
underflow arithmetic. Security based on 1 master
PIN code.

– enter your sheet of codes to be protected, into pins array
– check the 3 variables that control what kind of PINs are accepted
– enter your main PIN code
– run program to produce output sheet of encrypted PINs

The over- and underflow means that each PIN, containing
arabian numeric characters (0..9), is added a key number.
The key number is overflowing (if over 9, goes from 0 and round again)
and underflowing (if decreasing 0, then roll over to 9 and count down).
This means the lineage is infinite. You can use

Freely distributable, keep the copyright and e-mail
markings intact. Enjoy. No guarantees as usual.

DO NOT use for counterfeiting, hacking, or any other purpose
which might bring you harm. Do as ye wish, less harm none.

Feedback appreciated:

Jukka Paulin, CS Student
November 2001, Finland

= I wish a *peaceful Christmas* to all the people in the world. =
= Stop the war. Revenge begets revenge! Recursion quite obvious. =
= Over and out. =


#define PIN_COUNT 74
#define MAX_PIN_LEN 4
#define MAX_KEY_LEN 4

char * pins[PIN_COUNT] = {

char * confirmCodes [18] = {

Params: – *pin is the PIN number in asciiZ
– *key is the KEY in asciiZ
– *targetBuffer is where the encoded PIN gets written
void encode (char *pin, const char *key, char *targetBuffer) {
int length;
int j;
char tmp;

if (length<1) return;
if (length>MAX_KEY_LEN) {
printf (“\nerror: KEY too long. Maximum is: %d\n”,MAX_KEY_LEN);
for (j=0; j<length; j++) {
tmp = *pin++;
tmp += *key++ – ‘0’;
if (tmp > ‘9’) tmp -= 10;
*targetBuffer++ = tmp;

Makes a Nordea SOLO -type PIN list. This has 80 disposable
PINs and a fixed list of 18 verification codes. The verification
codes are not overwritten on use, they last until the whole list
– parameters: listOfPins = a pointer to PIN codes in ASCII
listOfCodes = a pointer to fixed codes in ASCII
codesLetters = a table of alphabets which match fixed codes
(might be eg. “ABCDEFGHJ” where ‘I’ is skipped because it
would morph easily with ‘1’. If the list length is less
than the amount of PINs, they used over again.)
startOrdinal = the ordinal number of first PIN, even if
the PIN actually omitted
excludedAmount = how many codes have been omitted from start
rowsInColumn = how many numbers to print in one vertical column
key = the encoding key */
int makeNordeaList (char *listOfPins[], char *listOfCodes[],
const char *codesLetters,
int startOrdinal, int excludedAmount,
int totalAmount, int rowsInColumn, const char *key)
char encoded[5];
int remainder;
int columns;
encoded[4] = 0; /* set string terminator */

/* Some fiddling first with the format of the output list.
– format the list so that it reminds the original one even
though some codes may have been omitted from the start
if (rowsInColumn == 0) {
printf (“\nError: rowsInColumn = 0. Not a valid format!\n”);
remainder = excludedAmount % rowsInColumn;
columns = totalAmount / rowsInColumn;

if ((excludedAmount > 0) && ((excludedAmount % rowsInColumn) != 0))
printf (“\nList needs modification on format.\n”);
} else {
/* List fine, needs no adjustment. */

int main ()
/* Params: pins, codes, chars, start, excluded, total, percolumn, key */
makeNordeaList (pins,confirmCodes,”ABCDEFGHJKLMNPRSTU”,
01, 7, 80, 10, “7890”);
return 0;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s