267. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:25 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

267.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\security\provider SHA5.java Mon Jan 22 14:46:54 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\security\provider SHA5.java Wed Sep 12 17:53:54 2018 UTC

267.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 574
Changed 1 2
Inserted 0 0
Removed 0 0

267.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

267.4 Active regular expressions

No regular expressions were active.

267.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 200 2, 2012, O racle and/ or its aff iliates. A ll rights  reserved.
  3    * DO NOT  ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER.
  4    *
  5    * This co de is free  software;  you can r edistribut e it and/o r modify i t
  6    * under t he terms o f the GNU  General Pu blic Licen se version  2 only, a s
  7    * publish ed by the  Free Softw are Founda tion.  Ora cle design ates this
  8    * particu lar file a s subject  to the "Cl asspath" e xception a s provided
  9    * by Orac le in the  LICENSE fi le that ac companied  this code.
  10    *
  11    * This co de is dist ributed in  the hope  that it wi ll be usef ul, but WI THOUT
  12    * ANY WAR RANTY; wit hout even  the implie d warranty  of MERCHA NTABILITY  or
  13    * FITNESS  FOR A PAR TICULAR PU RPOSE.  Se e the GNU  General Pu blic Licen se
  14    * version  2 for mor e details  (a copy is  included  in the LIC ENSE file  that
  15    * accompa nied this  code).
  16    *
  17    * You sho uld have r eceived a  copy of th e GNU Gene ral Public  License v ersion
  18    * 2 along  with this  work; if  not, write  to the Fr ee Softwar e Foundati on,
  19    * Inc., 5 1 Franklin  St, Fifth  Floor, Bo ston, MA 0 2110-1301  USA.
  20    *
  21    * Please  contact Or acle, 500  Oracle Par kway, Redw ood Shores , CA 94065  USA
  22    * or visi t www.orac le.com if  you need a dditional  informatio n or have  any
  23    * questio ns.
  24    */
  25  
  26   package su n.security .provider;
  27  
  28   import jav a.security .*;
  29   import jav a.math.Big Integer;
  30  
  31   import sta tic sun.se curity.pro vider.Byte ArrayAcces s.*;
  32  
  33   /**
  34    * This cl ass implem ents the S ecure Hash  Algorithm  SHA-384 a nd SHA-512
  35    * develop ed by the  National I nstitute o f Standard s and Tech nology alo ng
  36    * with th e National  Security  Agency.
  37    *
  38    * The two  algorithm s are almo st identic al. This f ile contai ns a base
  39    * class S HA5 and tw o nested s tatic subc lasses as  the classe s to be us ed
  40    * by the  JCA framew ork.
  41    *
  42    * <p>It i mplements  java.secur ity.Messag eDigestSpi , and can  be used
  43    * through  Java Cryp tography A rchitectur e (JCA), a s a plugga ble
  44    * Message Digest imp lementatio n.
  45    *
  46    * @since        1.4. 2
  47    * @author       Vale rie Peng
  48    * @author       Andr eas Sterbe nz
  49    */
  50   abstract c lass SHA5  extends Di gestBase {
  51  
  52       privat e static f inal int I TERATION =  80;
  53       // Con stants for  each roun d/iteratio n
  54       privat e static f inal long[ ] ROUND_CO NSTS = {
  55           0x 428A2F98D7 28AE22L, 0 x713744912 3EF65CDL,  0xB5C0FBCF EC4D3B2FL,
  56           0x E9B5DBA581 89DBBCL, 0 x3956C25BF 348B538L,  0x59F111F1 B605D019L,
  57           0x 923F82A4AF 194F9BL, 0 xAB1C5ED5D A6D8118L,  0xD807AA98 A3030242L,
  58           0x 12835B0145 706FBEL, 0 x243185BE4 EE4B28CL,  0x550C7DC3 D5FFB4E2L,
  59           0x 72BE5D74F2 7B896FL, 0 x80DEB1FE3 B1696B1L,  0x9BDC06A7 25C71235L,
  60           0x C19BF174CF 692694L, 0 xE49B69C19 EF14AD2L,  0xEFBE4786 384F25E3L,
  61             0x0FC19DC6 8B8CD5B5L,  0x240CA1C SITE C9C65L, 0x 2DE92C6F59 2B0275L,
  62           0x 4A7484AA6E A6E483L, 0 x5CB0A9DCB D41FBD4L,  0x76F988DA 831153B5L,
  63           0x 983E5152EE 66DFABL, 0 xA831C66D2 DB43210L,  0xB00327C8 98FB213FL,
  64           0x BF597FC7BE EF0EE4L, 0 xC6E00BF33 DA88FC2L,  0xD5A79147 930AA725L,
  65           0x 06CA6351E0 03826FL, 0 x142929670 A0E6E70L,  0x27B70A85 46D22FFCL,
  66           0x 2E1B21385C 26C926L, 0 x4D2C6DFC5 AC42AEDL,  0x53380D13 9D95B3DFL,
  67           0x 650A73548B AF63DEL, 0 x766A0ABB3 C77B2A8L,  0x81C2C92E 47EDAEE6L,
  68           0x 92722C8514 82353BL, 0 xA2BFE8A14 CF10364L,  0xA81A664B BC423001L,
  69           0x C24B8B70D0 F89791L, 0 xC76C51A30 654BE30L,  0xD192E819 D6EF5218L,
  70           0x D699062455 65A910L, 0 xF40E35855 771202AL,  0x106AA070 32BBD1B8L,
  71           0x 19A4C116B8 D2D0C8L, 0 x1E376C085 141AB53L,  0x2748774C DF8EEB99L,
  72           0x 34B0BCB5E1 9B48A8L, 0 x391C0CB3C 5C95A63L,  0x4ED8AA4A E3418ACBL,
  73           0x 5B9CCA4F77 63E373L, 0 x682E6FF3D 6B2B8A3L,  0x748F82EE 5DEFB2FCL,
  74           0x 78A5636F43 172F60L, 0 x84C87814A 1F0AB72L,  0x8CC70208 1A6439ECL,
  75           0x 90BEFFFA23 631E28L, 0 xA4506CEBD E82BDE9L,  0xBEF9A3F7 B2C67915L,
  76           0x C67178F2E3 72532BL, 0 xCA273ECEE A26619CL,  0xD186B8C7 21C0C207L,
  77           0x EADA7DD6CD E0EB1EL, 0 xF57D4F7FE E6ED178L,  0x06F067AA 72176FBAL,
  78           0x 0A637DC5A2 C898A6L, 0 x113F9804B EF90DAEL,  0x1B710B35 131C471BL,
  79           0x 28DB77F523 047D84L, 0 x32CAAB7B4 0C72493L,  0x3C9EBE0A 15C9BEBCL,
  80           0x 431D67C49C 100D4CL, 0 x4CC5D4BEC B3E42B6L,  0x597F299C FC657E2AL,
  81           0x 5FCB6FAB3A D6FAECL, 0 x6C44198C4 A475817L
  82       };
  83  
  84       // buf fer used b y implComp ress()
  85       privat e long[] W ;
  86  
  87       // sta te of this  object
  88       privat e long[] s tate;
  89  
  90       // ini tial state  value. di fferent be tween SHA- 384 and SH A-512
  91       privat e final lo ng[] initi alHashes;
  92  
  93       /**
  94        * Cre ates a new  SHA objec t.
  95        */
  96       SHA5(S tring name , int dige stLength,  long[] ini tialHashes ) {
  97           su per(name,  digestLeng th, 128);
  98           th is.initial Hashes = i nitialHash es;
  99           st ate = new  long[8];
  100           W  = new long [80];
  101           im plReset();
  102       }
  103  
  104       final  void implR eset() {
  105           Sy stem.array copy(initi alHashes,  0, state,  0, state.l ength);
  106       }
  107  
  108       final  void implD igest(byte [] out, in t ofs) {
  109           lo ng bitsPro cessed = b ytesProces sed << 3;
  110  
  111           in t index =  (int)bytes Processed  & 0x7f;
  112           in t padLen =  (index <  112) ? (11 2 - index)  : (240 -  index);
  113           en gineUpdate (padding,  0, padLen  + 8);
  114  
  115           i2 bBig4((int )(bitsProc essed >>>  32), buffe r, 120);
  116           i2 bBig4((int )bitsProce ssed, buff er, 124);
  117           im plCompress (buffer, 0 );
  118  
  119           l2 bBig(state , 0, out,  ofs, engin eGetDigest Length());
  120       }
  121  
  122       /**
  123        * log ical funct ion ch(x,y ,z) as def ined in sp ec:
  124        * @re turn (x an d y) xor ( (complemen t x) and z )
  125        * @pa ram x long
  126        * @pa ram y long
  127        * @pa ram z long
  128        */
  129       privat e static l ong lf_ch( long x, lo ng y, long  z) {
  130           re turn (x &  y) ^ ((~x)  & z);
  131       }
  132  
  133       /**
  134        * log ical funct ion maj(x, y,z) as de fined in s pec:
  135        * @re turn (x an d y) xor ( x and z) x or (y and  z)
  136        * @pa ram x long
  137        * @pa ram y long
  138        * @pa ram z long
  139        */
  140       privat e static l ong lf_maj (long x, l ong y, lon g z) {
  141           re turn (x &  y) ^ (x &  z) ^ (y &  z);
  142       }
  143  
  144       /**
  145        * log ical funct ion R(x,s)  - right s hift
  146        * @re turn x rig ht shift f or s times
  147        * @pa ram x long
  148        * @pa ram s int
  149        */
  150       privat e static l ong lf_R(l ong x, int  s) {
  151           re turn (x >> > s);
  152       }
  153  
  154       /**
  155        * log ical funct ion S(x,s)  - right r otation
  156        * @re turn x cir cular righ t shift fo r s times
  157        * @pa ram x long
  158        * @pa ram s int
  159        */
  160       privat e static l ong lf_S(l ong x, int  s) {
  161           re turn (x >> > s) | (x  << (64 - s ));
  162       }
  163  
  164       /**
  165        * log ical funct ion sigma0 (x) - xor  of results  of right  rotations
  166        * @re turn S(x,2 8) xor S(x ,34) xor S (x,39)
  167        * @pa ram x long
  168        */
  169       privat e static l ong lf_sig ma0(long x ) {
  170           re turn lf_S( x, 28) ^ l f_S(x, 34)  ^ lf_S(x,  39);
  171       }
  172  
  173       /**
  174        * log ical funct ion sigma1 (x) - xor  of results  of right  rotations
  175        * @re turn S(x,1 4) xor S(x ,18) xor S (x,41)
  176        * @pa ram x long
  177        */
  178       privat e static l ong lf_sig ma1(long x ) {
  179           re turn lf_S( x, 14) ^ l f_S(x, 18)  ^ lf_S(x,  41);
  180       }
  181  
  182       /**
  183        * log ical funct ion delta0 (x) - xor  of results  of right  shifts/rot ations
  184        * @re turn long
  185        * @pa ram x long
  186        */
  187       privat e static l ong lf_del ta0(long x ) {
  188           re turn lf_S( x, 1) ^ lf _S(x, 8) ^  lf_R(x, 7 );
  189       }
  190  
  191       /**
  192        * log ical funct ion delta1 (x) - xor  of results  of right  shifts/rot ations
  193        * @re turn long
  194        * @pa ram x long
  195        */
  196       privat e static l ong lf_del ta1(long x ) {
  197           re turn lf_S( x, 19) ^ l f_S(x, 61)  ^ lf_R(x,  6);
  198       }
  199  
  200       /**
  201        * Com pute the h ash for th e current  block.
  202        *
  203        * Thi s is in th e same vei n as Peter  Gutmann's  algorithm  listed in
  204        * the  back of A pplied Cry ptography,  Compact i mplementat ion of
  205        * "ol d" NIST Se cure Hash  Algorithm.
  206        */
  207       final  void implC ompress(by te[] buf,  int ofs) {
  208           b2 lBig128(bu f, ofs, W) ;
  209  
  210           //  The first  16 longs  are from t he byte st ream, comp ute the re st of
  211           //  the W[]'s
  212           fo r (int t =  16; t < I TERATION;  t++) {
  213                W[t] = l f_delta1(W [t-2]) + W [t-7] + lf _delta0(W[ t-15])
  214                       +  W[t-16];
  215           }
  216  
  217           lo ng a = sta te[0];
  218           lo ng b = sta te[1];
  219           lo ng c = sta te[2];
  220           lo ng d = sta te[3];
  221           lo ng e = sta te[4];
  222           lo ng f = sta te[5];
  223           lo ng g = sta te[6];
  224           lo ng h = sta te[7];
  225  
  226           fo r (int i =  0; i < IT ERATION; i ++) {
  227                long T1  = h + lf_s igma1(e) +  lf_ch(e,f ,g) + ROUN D_CONSTS[i ] + W[i];
  228                long T2  = lf_sigma 0(a) + lf_ maj(a,b,c) ;
  229                h = g;
  230                g = f;
  231                f = e;
  232                e = d +  T1;
  233                d = c;
  234                c = b;
  235                b = a;
  236                a = T1 +  T2;
  237           }
  238           st ate[0] +=  a;
  239           st ate[1] +=  b;
  240           st ate[2] +=  c;
  241           st ate[3] +=  d;
  242           st ate[4] +=  e;
  243           st ate[5] +=  f;
  244           st ate[6] +=  g;
  245           st ate[7] +=  h;
  246       }
  247  
  248       public  Object cl one() thro ws CloneNo tSupported Exception  {
  249           SH A5 copy =  (SHA5) sup er.clone() ;
  250           co py.state =  copy.stat e.clone();
  251           co py.W = new  long[80];
  252           re turn copy;
  253       }
  254  
  255       /**
  256        * SHA -512 imple mentation  class.
  257        */
  258       public  static fi nal class  SHA512 ext ends SHA5  {
  259  
  260           pr ivate stat ic final l ong[] INIT IAL_HASHES  = {
  261                0x6a09e6 67f3bcc908 L, 0xbb67a e8584caa73 bL,
  262                0x3c6ef3 72fe94f82b L, 0xa54ff 53a5f1d36f 1L,
  263                0x510e52 7fade682d1 L, 0x9b056 88c2b3e6c1 fL,
  264                0x1f83d9 abfb41bd6b L, 0x5be0c d19137e217 9L
  265           };
  266  
  267           pu blic SHA51 2() {
  268                super("S HA-512", 6 4, INITIAL _HASHES);
  269           }
  270       }
  271  
  272       /**
  273        * SHA -384 imple mentation  class.
  274        */
  275       public  static fi nal class  SHA384 ext ends SHA5  {
  276  
  277           pr ivate stat ic final l ong[] INIT IAL_HASHES  = {
  278                0xcbbb9d 5dc1059ed8 L, 0x629a2 92a367cd50 7L,
  279                0x915901 5a3070dd17 L, 0x152fe cd8f70e593 9L,
  280                0x673326 67ffc00b31 L, 0x8eb44 a876858151 1L,
  281                0xdb0c2e 0d64f98fa7 L, 0x47b54 81dbefa4fa 4L
  282           };
  283  
  284           pu blic SHA38 4() {
  285                super("S HA-384", 4 8, INITIAL _HASHES);
  286           }
  287       }
  288   }