× 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.



This is intriguing.  I've never done this type of thing before.

How do you unencrpyt the data?  How do you keep the encrypted value from
always being the same for the same text?  A lot of passwords for ftp servers
have to be stored and it's always a security issue.

Phil


> -----Original Message-----
> From: mi400-admin@midrange.com [mailto:mi400-admin@midrange.com]On
> Behalf Of Jon Paris
> Sent: Saturday, March 16, 2002 2:01 PM
> To: mi400@midrange.com
> Subject: [MI400] MI a good use for encryption?
>
>
> You might find this sample useful.  It was originally supplied by Bruce
> Vining of the Rochester Lab.
>
> It uses prototypes for the MI functions and also deals with EBCDIC/ASCII
> issues.
>
>
>
>       * Sample RPG code which takes into consideration the EBCDIC
>       *   to ASCII conversion, the hash generation, and the creation of a
>       *   suitable text string.  The program assumes that EBCDIC
> means CCSID
> 37
>       *   and ASCII CCSID 819.  These assumptions may not hold
> true for all
>       *   languages.
>
>       * Courtesy Bruce Vining via Midrange-L (June 27 2000)
>
>      H DFTACTGRP(*NO) ACTGRP('QILE') BNDDIR('QC2LE')
>      D Cipher          PR                  EXTPROC('_CIPHER')
>      D                                 *   VALUE
>      D                                 *   VALUE
>      D                                 *   VALUE
>
>      D Convert         PR                  EXTPROC('_XLATEB')
>      D                                 *   VALUE
>      D                                 *   VALUE
>      D                               10u 0 VALUE
>
>      D cvthc           PR                  EXTPROC('cvthc')
>      D                                1
>      D                                1
>      D                               10i 0 VALUE
>
>      D Controls        DS
>      D  Function                      5i 0 inz(5)
>      D  HashAlg                       1    inz(x'00')
>      D  Sequence                      1    inz(x'00')
>      D  DataLngth                    10i 0 inz(15)
>      D  Unused                        8    inz(*LOVAL)
>      D  HashCtxPtr                     *   inz(%addr(HashWorkArea))
>
>      D HashWorkArea    S             96    inz(*LOVAL)
>      D Msg             S             50
>      D ReceiverHex     S             16
>      D ReceiverPtr     S               *   inz(%addr(ReceiverHex))
>      D ReceiverChr     S             32
>      D SourcePtr       S               *   inz(%addr(Msg))
>      D StartMap        s            256
>      D To819           s            256
>      D CCSID1          s             10i 0 inz(37)
>      D ST1             s             10i 0 inz(0)
>      D L1              s             10i 0 inz(%size(StartMap))
>      D CCSID2          s             10i 0 inz(819)
>      D ST2             s             10i 0 inz(0)
>      D GCCASN          s             10i 0 inz(0)
>      D L2              s             10i 0 inz(%size(To819))
>      D L3              s             10i 0
>      D L4              s             10i 0
>      D FB              s             12
>
>      D                 ds
>      D x                              5i 0
>      D LowX                    2      2
>
>       * Get all single byte ebcdic hex values
>      C     0             do        255           x
>      C                   eval      %subst(StartMap:x+1:1) = LowX
>      C                   enddo
>
>       * Get conversion table for 819 from 37
>      C                   call      'QTQCVRT'
>      C                   parm                    CCSID1
>      C                   parm                    ST1
>      C                   parm                    StartMap
>      C                   parm                    L1
>      C                   parm                    CCSID2
>      C                   parm                    ST2
>      C                   parm                    GCCASN
>      C                   parm                    L2
>      C                   parm                    To819
>      C                   parm                    L3
>      C                   parm                    L4
>      C                   parm                    FB
>
>       * Set message text
>      C                   eval      Msg = 'message digest'
>      C                   eval      DataLngth = %len(%trimr(Msg))
>
>       * Now Change Msg to 819 from 37 using MI
>      C                   callp     Convert( %addr(Msg)
>      C                                     :%addr(To819)
>      C                                     :%size(Msg))
>
>       * Get MD5 for Msg
>      C                   callp     Cipher( %addr(ReceiverPtr)
>      C                                    :%addr(Controls)
>      C                                    :%addr(SourcePtr))
>
>       * Convert nibbles to characters
>      C                   callp     cvthc( ReceiverChr
>      C                                   :ReceiverHex
>      C                                   :%size(ReceiverChr))
>
>       * Display the "proof"
>      C     ReceiverChr   dsply
>      C                   eval      *INLR = '1'
>
>      C                   return
>
> Jon Paris
> Partner400
>
>
>
> _______________________________________________
> This is the MI Programming on the AS400 / iSeries (MI400) mailing list
> To post a message email: MI400@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/mi400
> or email: MI400-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/mi400.
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.