Skip to content

Commit

Permalink
Include leading zeros in each byte of hex fingerprint output
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-smallshire authored and rkluszczynski committed Nov 8, 2017
1 parent f793b6d commit 5222725
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public String execute(CliMainParameters mainParameters) {

String fingerprintString = "";
for (byte b : bytes) {
fingerprintString += String.format("%x", b);
fingerprintString += String.format("%02x", b);
}
return fingerprintString;
} catch (NoSuchAlgorithmException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FingerprintCommandTest extends BaseTestSpecification {
algorithmName | fingerprintValue
'CRC-64-AVRO' | '8db714e9ffa989a2'
'MD5' | 'f53ea32559669f2659949fe064c091c3'
'SHA-256' | 'd8df4d61a04ac76369f63ef7861b98f9a9dddc28ef0d3d65326de5493c9'
'SHA-256' | 'd8df4d61a004ac76369f63ef7861b908f90a9dddc28ef00d3d65326de50493c9'
}

def 'should calculate Rabin fingerprint'() {
Expand All @@ -34,7 +34,7 @@ class FingerprintCommandTest extends BaseTestSpecification {
trimmedOutput() == '0918bd124db26deb'
}

def 'should fail for no existing algorihtm'() {
def 'should fail for no existing algorithm'() {
when:
commandService.executeCommand('fingerprint', '-a', 'NOT-EXISTING-ALGORITHM',
'--schema', prepareSchemaPath('schema-no-fields.avsc')
Expand Down

0 comments on commit 5222725

Please sign in to comment.