source: FOIAVistA/tag/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUMF5BYT.m@ 1096

Last change on this file since 1096 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.4 KB
Line 
1XUMF5BYT ;ISS/DAVID Empey- XUMF5 MD5 Hash Utility ;06/17/05
2 ;;8.0;KERNEL;**383**;July 10, 1995
3 ;
4 ;Reverses bytes in each hash string 'word' from the MD5 routine
5 ;This is required because the MD5 routine
6 ;presents a hashcode with each word byte-reversed
7 ;
8MAIN(HASHIN) ;
9 N WORD1,WORD2,WORD3,WORD4,HASHOUT
10 ;
11 S WORD1=$E(HASHIN,1,8)
12 S WORD2=$E(HASHIN,9,16)
13 S WORD3=$E(HASHIN,17,24)
14 S WORD4=$E(HASHIN,25,32)
15 ;
16 S HASHOUT=$$BYTSWTCH(WORD1)_$$BYTSWTCH(WORD2)_$$BYTSWTCH(WORD3)_$$BYTSWTCH(WORD4)
17 ;
18 Q HASHOUT
19 ;
20BYTSWTCH(WORD) ;
21 N PIECE1,PIECE2,PIECE3,PIECE4,RESULT
22 ;
23 S PIECE1=$E(WORD,1,2)
24 S PIECE2=$E(WORD,3,4)
25 S PIECE3=$E(WORD,5,6)
26 S PIECE4=$E(WORD,7,8)
27 ;
28 S RESULT=PIECE4_PIECE3_PIECE2_PIECE1
29 ;
30 Q RESULT
31 ;
32TEST ;
33 N OK
34 S OK=1
35 S:$$MAIN("d98c1dd404b2008f980980e97e42f8ec")'="d41d8cd98f00b204e9800998ecf8427e" OK=0
36 S:$$MAIN("b975c10ca8b6f1c0e299c33161267769")'="0cc175b9c0f1b6a831c399e269772661" OK=0
37 S:$$MAIN("98500190b04fd23c7d3f96d6727fe128")'="900150983cd24fb0d6963f7d28e17f72" OK=0
38 S:$$MAIN("7d696bf98d93b77c312f5a52d061f1aa")'="f96b697d7cb7938d525a2f31aaf161d0" OK=0
39 S:$$MAIN("d7d3fcc300e492616c49fb7d3be167ca")'="c3fcd3d76192e4007dfb496cca67e13b" OK=0
40 S:$$MAIN("98ab74d1f5d977d22c1c61a59f9d419f")'="d174ab98d277d9f5a5611c2c9f419d9f" OK=0
41 S:$$MAIN("a2f4ed5755c9e32b2eda49ac7ab60721")'="57edf4a22be3c955ac49da2e2107b67a" OK=0
42 I OK=1 W !,"Tests passed." Q
43 W !,"Tests failed."
44 K HASHOUT
45 Q
Note: See TracBrowser for help on using the repository browser.