× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: MI Algorithm for Password Encryption
  • From: Gene Gaunt <issgg@xxxxxxx>
  • Date: Thu, 2 Dec 1999 22:44:09 -0700

Here's our implementation, with no loops:

dcl dd     User        auto char(10);
dcl dd     Password    auto char(10);
dcl dd     Encrypted   auto char(16);
dcl dd     Text        auto char(8);
dcl spcptr ?Text       auto init(Text);
dcl spcptr ?Cipher     auto;
dcl dd     Control     auto char(32);
dcl dd     Function    def(Control) pos(1) bin(2) init(2);
dcl dd     Size        def(Control) pos(3) bin(2) init(8);
dcl dd     Key         def(Control) pos(6) char(8);

    cpybrep     Encrypted, " ";
    cpybla      Text, User(1:8);
    cmpbla(b)   User(9:2), "  " / eq(AA);
    cpybtlls    Text(1:1), User( 9:1), X"0000";
    cpybtlls    Text(2:1), User( 9:1), X"0002";
    cpybtlls    Text(3:1), User( 9:1), X"0004";
    cpybtlls    Text(4:1), User( 9:1), X"0006";
    cpybtlls    Text(5:1), User(10:1), X"0000";
    cpybtlls    Text(6:1), User(10:1), X"0002";
    cpybtlls    Text(7:1), User(10:1), X"0004";
    cpybtlls    Text(8:1), User(10:1), X"0006";
    and(s)      Text, X"C0C0C0C0C0C0C0C0";
    xor(s)      Text, User(1:8);
AA: xor         Key, Password(1:8), X"5555555555555555";
    cpybtlls    Key, Key, X"0001";
    setspp      ?Cipher, Encrypted;
    cipher      ?Cipher, Control, ?Text;
    cmpbla(b)   Password(9:2), "  " / eq(BB);
    cpyblap     Key, Password(9:2), " ";
    xor(s)      Key, X"5555555555555555";
    cpybtlls    Key, Key, X"0001";
    addspp      ?Cipher, ?Cipher, 8;
    cipher      ?Cipher, Control, ?Text;
BB: brk         "LOOK";

If this is iterated, we get better performance by replacing CIPHER
with only pertinent DES components.  Since the DES initial and final
permutations cancel each other, they aren't needed in a password
manager.  Here is MI pseudocode to permute 64-bit DES blocks
in seven sequential instructions:

1. XLATE an 8-byte block into 64 bytes with a DES table
2. AND(S) the 64 bytes with a DES table
3. XLATE each 64 bytes into X'00' or X'FF'
4. AND(S) the 64 bytes with a sequential mask
5. OR(S) the 64 bytes into 32 bytes
6. OR(S) the 32 bytes into 16 bytes
7. OR(S) the 16 bytes into 8 bytes

The challenge here lies in transforming the FIPS PUB 46 tables
into binary operands for steps (1) and (2).  REXX compound variables
are the tools for this.  Get MAKECRYPT from News/400 and you'll
see how REXX transform FIPS PUB 46 into MI.

(The United States MAKECRYPT version is okay; the Italian version
translates MI indicator keyword NEG to NEQ, ruining decryption.) 

+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.