Cryptographic Calculator – Generic menu

Introduction

The EFTtools set consist of applications supporting payment transaction service development, testing and benchmarking. It currently consists of following components: Cryptographic Calculator and HSM Commander.

This tutorial focuses on Cryptographic Calculator functionality and is provided in six separated parts as per functionality topics covered by its main menu – Generic, Cipher, Keys, Payments, EMV and Development tools. This tutorial also aspires to provide bits of basic history on algorithms in use.

Generic Cryptography

This set of tools focuses on working with features as character encoding, hashing, UUID generation and check digits evaluation.

Hashes

Hashes are one-way destructible cryptography algorithms being frequently used for unique data identification and also for validation. You can meet them at all places across payments starting with payment message validation, EMV SDA and DDA procedures, networking protocols and ending perhaps with transaction database indexing. Our Hash Calculator provides you with following hashing options: MD4, MD5, SHA-1, SHA-224, SHA-256, SHA-348, SHA-512, RIPEMD-160, TIGER-192, CRC32, CRC32_RFC1510, CRC32_2440 and WHIRLPOOL.

Output from this function should read like this:

Hashes: Hashing operation finished
****************************************
Data:                    C1D0F8FB4958670DBA40AB1F3752EF0D
Hash type:               MD5
—————————————-
Hash:                    4C618FD14C14881EFB13352E400473B1

Character Encoding

In payments we do rely on understanding of different types of character encoding. Knowing how to translate Hexadecimal values to their binary representation and vice versa is vital. Similar applies for EBCDIC <->ASCII and ASCII -> Hexadecimal.

Typical use case can be like this:

Character Encoding: Encoding done
****************************************
Data In:                 57652C206174204546544C61622C2062656C6965766520746861742074657374696E67206D75737420656D706F77657220627573696E65737320616E64206E6F7420736C6F7720697420646F776E2E
—————————————-
Data Out:                We, at EFTLab, believe that testing must empower business and not slow it down.

BCD

BCD is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term BCD originates from a specific MIME content transfer encoding.
BCD encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact without modification during transport. BCD is commonly used in a number of applications including email via MIME, and storing complex data in XML.

BCD: Encoding finished
****************************************
Input Data (decimal): 25
—————————————-
Encoded Data (binary): 0010 0101
Encoded Data (hex): 25

Check Digits

Luhn Check

The Luhn algorithm or Luhn formula, also known as the “modulus 10” or “mod 10” algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in US and Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn and described in U.S. Patent No. 2,950,048, filed on January 6, 1954, and granted on August 23, 1960.

The algorithm is in the public domain and is in wide use today. It is specified in ISO/IEC 7812-1. It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.

The formula verifies a number against its included check digit, which is usually appended to a partial account number to generate the full account number. This account number must pass the following test:

  • From the rightmost digit, which is the check digit, moving left, double the value of every second digit; if the product of this doubling operation is greater than 9 (e.g., 7 × 2 = 14), then sum the digits of the products (e.g., 10: 1 + 0 = 1, 14: 1 + 4 = 5).
  • Take the sum of all the digits.
  • If the total modulo 10 is equal to 0 (if the total ends in zero) then the number is valid according to the Luhn formula; else it is not valid.

Digit check done
****************************************
Method: Luhn’s number (MOD 10)
Input:                    79927398713
—————————————-
Result:                   Check Passed

AMEX SE Number

American Express Service Establishment Number (SE Number) is a unique ten-digit number assigned by American Express to a merchant that accepts American Express cards.

Digit check done
****************************************
Method: Amex SE Number (MOD 9)
Input: 7992739874
—————————————-
Result: Check Passed

Base64

Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.

Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, URL address encoding and storing complex data in XML or databases.

Base64: Encoding finished
****************************************
Data:                    Hello World!
—————————————-
Encoded Data:            SGVsbG8gV29ybGQh

Base94

Base94 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data.

This is to ensure that the data remains intact without modification during transport.

In this particular scenario Base94 encoding is using ASCII printable characters in the range 20 heexadecimal (space) to 7E hexadecimal (tilde).
The following base 94 encoding scheme gives a ratio for encoded bytes to binary bytes of 5 to 4. Thus a 256 byte RSA block can be transmitted in 320 bytes.
Following encoding process is used:
– form 32-bit word from each four bytes of input data so that first byte will become a least significant byte of the output
– convert the 32-bit word into five Base94 digits (printable characters), beginning from 20 hexadecimal (space), the first digit is the least significant.

Base94: Encoding finished
****************************************
Input Data (ASCII): Hello World!
—————————————-
Encoded Data: l8′<7Ac}v72&O0′

Base94: Decoding finished
****************************************
Data: l8′<7Ac}v72&O0′
—————————————-
Decoded Data: Hello World!

Message Parser

Convert bytes to human readable traces.

Parse modes:
– ISO 8583 rev. 1987
– ATM NDC
– ATM Wincor

Message Parsing:
****************************************
Input Data:
0000: 30 31 30 30 b2 3a 06 c1 20 e0 90 a0 00 00 00 00 0100.:.. …….
0010: 00 00 00 00 30 30 30 30 30 30 39 39 39 39 39 39 ….000000999999
0020: 39 39 39 39 39 39 31 31 32 33 31 31 34 31 34 31 9999991123114141
0030: 30 31 34 31 32 37 31 31 34 31 34 31 31 31 32 33 0141271141411123
0040: 31 31 31 35 30 32 31 30 30 31 34 31 30 34 30 33 1115021001410403
… SHORTENED …
03d0: 30 37 32 31 31 42 61 74 63 68 4e 75 6d 62 65 72 07211BatchNumber
03e0: 32 31 30 30 30 30 30 30 30 30 30 30 31 31 37 50 210000000000117P
03f0: 6f 73 43 6f 64 65 32 31 32 42 31 30 31 30 31 32 osCode212B101012
0400: 31 34 31 32 43 1412C
—————————————-
Parse Completed:
{
“fields” :
{
“f0001” :
{
“data” : “0000000000000000”,
“encoding” : “binary”,
“format” : “None”,
“name” : “Secondary Bitmap”,
“number” : 1
},
“f0003” :
{
“data” : “000000”,
“encoding” : “ascii”,
“format” : “n”,
“name” : “Processing code”,
“number” : 3
},
“f0004” :
{
“data” : “999999999999”,
“encoding” : “ascii”,
“format” : “n”,
“name” : “Amount, transaction”,
“number” : 4
},
“f0007” :
{
“data” : “1123114141”,
“encoding” : “ascii”,
“format” : “MMDDhhmmss”,
“name” : “Transaction date and time”,
“number” : 7
},
“f0011” :
{
“data” : “014127”,
“encoding” : “ascii”,
“format” : “n”,
“name” : “System trace audit number”,
“number” : 11
},
“f0012” :
{
“data” : “114141”,
“encoding” : “ascii”,
“format” : “hhmmss”,
“name” : “Time, local transaction”,
“number” : 12
},
“f0013” :
{
“data” : “1123”,
“encoding” : “ascii”,
“format” : “MMDD”,
“name” : “Date, local transaction”,
“number” : 13
},
“f0015” :
{
“data” : “1115”,
“encoding” : “ascii”,
“format” : “MMDD”,
“name” : “Date, settlement”,
“number” : 15
},
“f0022” :
{
“data” : “021”,
“encoding” : “ascii”,
“format” : “n”,
“name” : “Point of service primary mode”,
“number” : 22
},
… SHORTENED …
“f0052” :
{
“data” : “****************”,
“encoding” : “binary”,
“format” : “b”,
“name” : “PIN data”,
“number” : 52
},
“f0057” :
{
“data” : “330”,
“encoding” : “ascii”,
“format” : “ans”,
“name” : “Reserved national”,
“number” : 57
},
“f0059” :
{
“data” : “0000000001 0000000001002124000000000000000000000000 “,
“encoding” : “ascii”,
“format” : “ans”,
“name” : “Reserved national”,
“number” : 59
}
},
“messageType” : “0100”
} ****************************************

RSA DER Public Key

Provides RSA DER Public Key Encode and Decode functions.

RsaDerPublicKey: Encoding finished
****************************************
Input Exponent (ASCII_HEX): 010001


Input Modulus (ASCII_HEX): 00863ED85278147D6E68FC9475E5F7431620C409357031EE093A0E0640027361F531AF5F9D252D7287DFCD645AC276B8F145D3D9D978638486DCC61A228AD350B918D72438D6E0499AE0ABC8A5C76E4B3C6A99A0983562BB0756500361F13583DFD2D75F2FD42172FDB6B3E3B18963F1844108A2878D7E6D1B0E242A7C5185994CDD21C840B6F69818704CB74CB23FF213048F6AFA48737ADB22A5A739F8D697BD2D93CCD7D4BD7A2FD040532C685C1F57C904CA1ACA6A89746A488B68A8436CEDFF1B828AF3155D6C37E06A11D21AB9B843086A0C0375742D34C53DE6FD98C0A6BA5F1AD929216E49AD080099CFD1F7EAC8F835976A1CF3778C94D40E469E31E9


Input Is Modulus Negative: No
—————————————-
Encoded Type: ENCODING_01_DER_ASN1_PUBLIC_KEY_UNSIGNED
Encoded Data: 3082010A0282010100863ED85278147D6E68FC9475E5F7431620C409357031EE093A0E0640027361F531AF5F9D252D7287DFCD645AC276B8F145D3D9D978638486DCC61A228AD350B918D72438D6E0499AE0ABC8A5C76E4B3C6A99A0983562BB0756500361F13583DFD2D75F2FD42172FDB6B3E3B18963F1844108A2878D7E6D1B0E242A7C5185994CDD21C840B6F69818704CB74CB23FF213048F6AFA48737ADB22A5A739F8D697BD2D93CCD7D4BD7A2FD040532C685C1F57C904CA1ACA6A89746A488B68A8436CEDFF1B828AF3155D6C37E06A11D21AB9B843086A0C0375742D34C53DE6FD98C0A6BA5F1AD929216E49AD080099CFD1F7EAC8F835976A1CF3778C94D40E469E31E90203010001

RsaDerPublicKey: Decoding finished
****************************************
Data: 3082010A0282010100863ED85278147D6E68FC9475E5F7431620C409357031EE093A0E0640027361F531AF5F9D252D7287DFCD645AC276B8F145D3D9D978638486DCC61A228AD350B918D72438D6E0499AE0ABC8A5C76E4B3C6A99A0983562BB0756500361F13583DFD2D75F2FD42172FDB6B3E3B18963F1844108A2878D7E6D1B0E242A7C5185994CDD21C840B6F69818704CB74CB23FF213048F6AFA48737ADB22A5A739F8D697BD2D93CCD7D4BD7A2FD040532C685C1F57C904CA1ACA6A89746A488B68A8436CEDFF1B828AF3155D6C37E06A11D21AB9B843086A0C0375742D34C53DE6FD98C0A6BA5F1AD929216E49AD080099CFD1F7EAC8F835976A1CF3778C94D40E469E31E90203010001
Encoded As: ENCODING_01_DER_ASN1_PUBLIC_KEY_UNSIGNED
—————————————-
Encoding: ASCII_HEX
Modulus: 00863ED85278147D6E68FC9475E5F7431620C409357031EE093A0E0640027361F531AF5F9D252D7287DFCD645AC276B8F145D3D9D978638486DCC61A228AD350B918D72438D6E0499AE0ABC8A5C76E4B3C6A99A0983562BB0756500361F13583DFD2D75F2FD42172FDB6B3E3B18963F1844108A2878D7E6D1B0E242A7C5185994CDD21C840B6F69818704CB74CB23FF213048F6AFA48737ADB22A5A739F8D697BD2D93CCD7D4BD7A2FD040532C685C1F57C904CA1ACA6A89746A488B68A8436CEDFF1B828AF3155D6C37E06A11D21AB9B843086A0C0375742D34C53DE6FD98C0A6BA5F1AD929216E49AD080099CFD1F7EAC8F835976A1CF3778C94D40E469E31E9
Modulus Negative: No
Exponent: 010001

UUID

A universally unique identifier (UUID) is an identifier standard used in software construction. A UUID is simply a 128-bit value. The meaning of each bit is defined by any of several variants.

For human-readable display, many systems use a canonical format using hexadecimal text with inserted hyphen characters.

The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. In this context the word unique should be taken to mean ‘practically unique’ rather than ‘guaranteed unique’. Since the identifiers have a finite size, it is possible for two differing items to share the same identifier.

UUID: Generate UUID Variant 4 (random) finished
****************************************
UUID:        5e0835cc-1975-425f-b937-19c0cdb89103

Summary

In this article, we went through the functionality of Cryptographic Calculator covered by the Generic Menu.

Cryptographic Calculator and other tools covered in EFTtools suite were designed to help and assist payment industry people in their day to day tasks and make their work the most effective. Our team would be grateful if you would suggest any improvements to our applications or report completely new functionality needed. Feedback from our users like this is exactly what drives the development of its and helps us to share our experience to wide public.