Produced by Araxis Merge on 4/5/2017 4:25:29 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\working_scrub\Unredacted\VAP Code Base\VAP_Bld2_Source_Code_CIF_2017-02-14\nvap-common\src\main\java\gov\va\nvap\common\util | IcnChecksum.java | Wed Feb 1 18:37:28 2017 UTC |
| 2 | eHX-CIF.zip\eHX-CIF\VAP Code Base\VAP_Bld2_Source_Code_CIF_2017-02-14\nvap-common\src\main\java\gov\va\nvap\common\util | IcnChecksum.java | Mon Apr 3 14:00:49 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 266 |
| Changed | 1 | 2 |
| 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.nvap. common.uti l; | |
| 2 | ||
| 3 | /** | |
| 4 | * @author
|
|
| 5 | * | |
| 6 | * <p> | |
| 7 | * Class con tains algo rithm for generating checksums for ICNs that | |
| 8 | * conforms to the M r outine tha t does the same thin g. | |
| 9 | */ | |
| 10 | public cla ss IcnChec ksum { | |
| 11 | ||
| 12 | /* * Arrays o f integers that are used to ge nerate the checksum. */ | |
| 13 | pr ivate stat ic final i nt TABLE[] [][] = { | |
| 14 | { { 4, 9, 7, 4, 4, 4, 4, 0 , 9, 9, 7, 7, 8, 4, 6, 8 }, | |
| 15 | { 5, 0, 6, 5, 1, 1, 2, 3, 6, 5 , 3, 5, 7, 6, 5, 5 } , | |
| 16 | { 9, 4, 2, 0, 3, 7, 5, 1, 7, 1 , 0, 9, 0, 3, 2, 2 } , | |
| 17 | { 3, 2, 1, 7, 7, 0, 6, 9, 2, 4 ,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
| 73 | { 2, 9, 1, 4, 9, 9, 4, 0, 1, 3 , 9, 3, 0, 2, 5, 6 } , | |
| 74 | { 7, 0, 3, 8, 6, 8, 0, 1, 3, 0 , 5, 9, 2, 8, 3, 8 } , | |
| 75 | { 9, 6, 5, 6, 3, 4, 2, 6, 7, 6 , 3, 2, 7, 4, 1, 3 } , | |
| 76 | { 4, 8, 6, 7, 4, 5, 1, 3, 5, 1 , 6, 1, 6, 3, 0, 5 } , | |
| 77 | { 3, 5, 4, 1, 5, 7, 5, 5, 9, 2 , 8, 0, 8, 5, 7, 7 } , | |
| 78 | { 1, 4, 7, 0, 2, 0, 8, 2, 0, 8 , 1, 8, 5, 0, 4, 2 } } }; | |
| 79 | ||
| 80 | /* * | |
| 81 | * Adds the 'V' and th e checksum to the IC N passed i n as a par ameter and | |
| 82 | * returns i t. | |
| 83 | * | |
| 84 | * @param ic n | |
| 85 | * The ICN to calcula te and app end the ch eck sum to . | |
| 86 | * @return T he ICN wit h the chec k sum appe nded. | |
| 87 | * / | |
| 88 | pu blic stati c String a ddChecksum ToIcn(fina l String i cn) { | |
| 89 | retu rn icn + " V" + IcnCh ecksum.gen erateIcnCh ecksum(icn ); | |
| 90 | } | |
| 91 | ||
| 92 | /* * | |
| 93 | * Generates the check sum for th e ICN pass ed in as a parameter . | |
| 94 | * | |
| 95 | * @param ic n | |
| 96 | * The icn to generat e the chec ksum for. | |
| 97 | * @return T he checksu m for the ICN. | |
| 98 | * / | |
| 99 | pu blic stati c String g enerateIcn Checksum(f inal Strin g icn) { | |
| 100 | ||
| 101 | fina l StringBu ilder out = new Stri ngBuilder( ); | |
| 102 | fina l StringBu ilder buf = new Stri ngBuilder( icn); | |
| 103 | fina l int map[ ] = { 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0 }; | |
| 104 | ||
| 105 | whil e (buf.len gth() < 16 ) { | |
| 106 | buf.in sert(0, "0 "); | |
| 107 | } | |
| 108 | ||
| 109 | for (int i = 0 ; i < 6; i ++) { | |
| 110 | ||
| 111 | for (i nt j = 0; j < 16; j+ +) { | |
| 112 | ||
| 113 | final St ring s = b uf.substri ng(j, j + 1); | |
| 114 | int n; | |
| 115 | ||
| 116 | try { | |
| 117 | n = Intege r.parseInt (s); | |
| 118 | } catch (final Num berFormatE xception e ) { | |
| 119 | n = 0; | |
| 120 | } | |
| 121 | ||
| 122 | final in t sum = (n + map[j]) % 10; | |
| 123 | map[j + 1] = IcnCh ecksum.TAB LE[i][sum] [j]; | |
| 124 | } | |
| 125 | ||
| 126 | out.ap pend(map[1 6]); | |
| 127 | ||
| 128 | } | |
| 129 | ||
| 130 | retu rn out.toS tring(); | |
| 131 | ||
| 132 | } | |
| 133 | ||
| 134 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.