Produced by Araxis Merge on 3/24/2017 5:17:18 PM Eastern 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_common\mhv-common-api\src\main\java\gov\va\med\mhv\core\crypto | ChecksumCalculator.java | Thu Feb 11 17:10:34 2016 UTC |
| 2 | MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_common\mhv-common-api\src\main\java\gov\va\med\mhv\core\crypto | ChecksumCalculator.java | Fri Mar 24 20:04:23 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 5 | 116 |
| Changed | 4 | 10 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | package go v.va.med.m hv.core.cr ypto; | |
| 2 | ||
| 3 | import jav a.io.Seria lizable; | |
| 4 | import jav a.security .MessageDi gest; | |
| 5 | import jav a.security .NoSuchAlg orithmExce ption; | |
| 6 | ||
| 7 | import org .springfra mework.uti l.Assert; | |
| 8 | ||
| 9 | /** | |
| 10 | * Provide s calculat ion of a c hecksum, b ased on a specific a lgorithm, | |
| 11 | * from a given inpu t. | |
| 12 | * @author Rob Prope r | |
| 13 | * | |
| 14 | */ | |
| 15 | public cla ss Checksu mCalculato r implemen ts Seriali zable { | |
| 16 | ||
| 17 | /* * | |
| 18 | * encrypt | |
| 19 | * / | |
| 20 | pu blic stati c final St ring DEFAU LT_ALGORIT HM = " encrypt "; | |
| 21 | ||
| 22 | pr ivate fina l MessageD igest dige ster; | |
| 23 | ||
| 24 | /* * | |
| 25 | * Creates a checksum calculator based on the defaul t algorith m. | |
| 26 | * @see #DEF AULT_ALGOR ITHM | |
| 27 | * @throws N oSuchAlgor ithmExcept ion When t here is no provider for | |
| 28 | * the defau lt algorit hm | |
| 29 | * / | |
| 30 | pu blic Check sumCalcula tor() thro ws NoSuchA lgorithmEx ception { | |
| 31 | this (DEFAULT_A LGORITHM); | |
| 32 | } | |
| 33 | ||
| 34 | /* * | |
| 35 | * Creates a checksum calculator based on the given algorithm. | |
| 36 | * @param al gorithm Th e algorith m to use f or calcula tions. | |
| 37 | * @throws N oSuchAlgor ithmExcept ion When t here is no provider for | |
| 38 | * the given algorithm | |
| 39 | * / | |
| 40 | pu blic Check sumCalcula tor(String algorithm ) | |
| 41 | thro ws NoSuchA lgorithmEx ception | |
| 42 | { | |
| 43 | dige ster = Mes sageDigest .getInstan ce(algorit hm); | |
| 44 | } | |
| 45 | ||
| 46 | /* * | |
| 47 | * Calculate s the chec ksum for a given inp ut. | |
| 48 | * @param in put The in put to cal culate the checksum from | |
| 49 | * @return T he checksu m calculat ed from th e given in put. | |
| 50 | * / | |
| 51 | pu blic Strin g calculat e(String i nput) { | |
| 52 | Asse rt.notNull (input); | |
| 53 | //Pr econdition .assertNot Null("inpu t", input) ; | |
| 54 | dige ster.updat e(input.ge tBytes()); | |
| 55 | byte[] encrypt = digeste r.digest() ; | |
| 56 | Stri ngBuffer b uffer = ne w StringBu ffer(); | |
| 57 | for(int i = 0; i < encrypt .length; i ++) { | |
| 58 | buffer.app end(Intege r.toHexStr ing( encrypt [i])); | |
| 59 | } | |
| 60 | retu rn buffer. toString() ; | |
| 61 | } | |
| 62 | ||
| 63 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.