Giter Site home page Giter Site logo

hash-pli's Introduction

HASH-PLI

PL/I implementation of some hash functions.

I performed a parallel test of these hash algorithms on IBM Mainframe and PC. I calculated the CRC-32 and SHA-2 codes of files with FreeCommander and Total Commander (SipHash was checked online) on PC. After uploading the files to Mainframe, I repeated the hash calculation there as well. The algorithm implemented in PL/I gives the same result.

If you have a license for the C compiler on the Mainframe, you have an easier task. :)

What is the PL/I programming language?

PL/I is one of the oldest programming languages still used in present-day on IBM Mainframe computers.

Tested with:

CPU: IBM z15 8561-710 (big-endian)
Operating system: z/OS 2.5
Compiler: IBM(R) Enterprise PL/I for z/OS V5.R3.M0

Performance:

Tested 100 times with 1 MB data.

Algorithm Speed (MB/sec)
CRC-32 112,48
SipHash-2-4 64 bit 230,41
SHA-224 223,21
SHA-256 223,71
SHA-384 64,30
SHA-512 64,47
SHA-512/224 64,35
SHA-512/256 64,64

How to call?

More sample calls can be found in the HASH.PLI main program.

Sample PL/I code to call SHA-512:

      DECLARE
 (ADDR,STG,NULL, UTF8,UTF8TOCHAR,HEX)  BUILTIN;
 %INCLUDE O(PPMMAC);    /* GENERAL PL/I PREPROCESSORS MACROS          */
 %INCLUDE O(SHA2);      /* TYPE DEFINITIONS FOR THE SHA2 ALGORITHM    */
      DECLARE
 TEST_STR1      CHAR(43) STATIC
              INIT(UTF8('The quick brown fox jumps over the lazy dog')),
 SHA512_DIGEST  TYPE SHA512_DIGEST_TYPE;

    SHA512_DIGEST = SHA512(ADDR(TEST_STR1), STG(TEST_STR1));
    PUT EDIT('TEST SHA512',
             'INPUT      : "', UTF8TOCHAR(TEST_STR1), '"',
             'HASH VALUE : ' , HEX(SHA512_DIGEST))
            (SKIP, A,
             SKIP, A,A,A,
             SKIP, A,A);

 %INCLUDE U(SHA2);      /* PL/I IMPLEMENTATION OF THE SHA2 ALGORITHM  */

Sample output in SYSPRINT:

It gives the same result that was written in Wikipedia.

TEST SHA512
INPUT      : "The quick brown fox jumps over the lazy dog"
HASH VALUE : 07E547D9586F6A73F73FBAC0435ED76951218FB7D0C8D788A309D785436BBB642E93A252A954F23912547D1E8A3B5ED6E1BFD7097821233FA0538F3DB854FEE6

Description of sources

Program name Description
CRC32.IPU PL/I implementation of the CRC-32 algorithm
HASH.PLI Main program for calling the HASH functions
PPMMAC.IPO General purpose PL/I preprocessors macros
SIPHASH.IPU PL/I implementation of the SipHash algorithm
SHA2.IPO Type definitions for the SHA2 functions
SHA2.IPU PL/I implementation of the SHA2 functions
SYSPRINT.txt Sample output

hash-pli's People

Contributors

vargajb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.