440. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/13/2018 10:35:32 AM Eastern Standard 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.

440.1 Files compared

# Location File Last Modified
1 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\util HashUtils.java Fri Dec 7 17:36:24 2018 UTC
2 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\fw\util HashUtils.java Wed Dec 12 19:52:48 2018 UTC

440.2 Comparison summary

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

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

440.4 Active regular expressions

No regular expressions were active.

440.5 Comparison detail

  1   /********* ********** ********** ********** ********** ********** *********
  2    * Copyrii ght 2009 V HA. All ri ghts reser ved
  3    ********* ********** ********** ********** ********** ********** *********/
  4  
  5   package go v.va.med.f w.util;
  6  
  7   import jav a.io.ByteA rrayOutput Stream;
  8   import jav a.security .MessageDi gest;
  9  
  10   import gov .va.med.fw .model.Has hSummary;
  11  
  12   /**
  13    * Central  utility f or hashing  needs.
  14    *
  15    * Origina l Author -          DN S
  16    * Creatio n Date - O ct 29, 200 9 3:09:41  PM
  17    */
  18   public cla ss HashUti ls {
  19           pu blic stati c final ch ar[] HEX_C HARS = { ' 0', '1', ' 2', '3', ' 4', '5', ' 6', '7', ' 8', '9', ' a', 'b', ' c',
  20                             'd', ' e', 'f' };
  21  
  22           pu blic stati c final St ring DEFAU LT_ALGORIT HM = "SHA- 256";
  23                    
  24           pu blic stati c HashSumm ary hash(O bject item ToHash, St ring algor ithm) thro ws Excepti on {
  25                    retu rn hash(it emToHash,  null, algo rithm);
  26           }
  27           
  28           pu blic stati c HashSumm ary hash(O bject item ToHash) th rows Excep tion {
  29                    retu rn hash(it emToHash,  null, DEFA ULT_ALGORI THM);
  30           }
  31  
  32           pu blic stati c HashSumm ary hash(O bject item ToHash, St ring key,  String alg orithm) th rows Excep tion{
  33                    if(i temToHash  == null &&  key == nu ll)
  34                             return  null;
  35                    
  36                    // T ODO: if Me ssageDiges t is threa d-safe, co uld share  static ins tance
  37                    Mess ageDigest  digest = j ava.securi ty.Message Digest.get Instance(a lgorithm);
  38                    
  39                    /*Sy stem.out.p rintln("Ha sh perform ed using M essageDige st [name /  version /  info]: ["  + digest. getProvide r().getNam e() +
  40                                      " / " +  digest.get Provider() .getVersio n() + " /  " + digest .getProvid er().getIn fo() + "]" );
  41                    */
  42                    
  43                    int  hash = ite mToHash.ha shCode();
  44                    Byte ArrayOutpu tStream ba os = new B yteArrayOu tputStream ();
  45                    baos .write(has h);
  46                    if (  key != nu ll ) {
  47                             baos.w rite(key.g etBytes()) ;
  48                    }
  49                    dige st.update( baos.toByt eArray());
  50                    byte [] hashSig  = digest. digest();
  51                    char  buf[] = n ew char[ha shSig.leng th * 2];
  52                    for  (int i = 0 , x = 0; i  < hashSig .length; i ++) {
  53                             buf[x+ +] = HEX_C HARS[(hash Sig[i] >>>  4) & 0xf] ;
  54                             buf[x+ +] = HEX_C HARS[hashS ig[i] & 0x f];
  55                    }
  56                    retu rn new Has hSummary(n ew String( buf), dige st);
  57           }
  58   }