Skip to content

Commit f18c282

Browse files
MikeEnRegaliahsz
authored andcommitted
pad md5 string with zeroes
2016/day-17 breaks without this, for example
1 parent feb2331 commit f18c282

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Utils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ fun readInput(name: String) = File("src", "$name.txt").readLines()
1010
/**
1111
* Converts string to md5 hash.
1212
*/
13-
fun String.md5(): String = BigInteger(1, MessageDigest.getInstance("MD5").digest(toByteArray())).toString(16)
13+
fun String.md5(): String = BigInteger(1, MessageDigest.getInstance("MD5").digest(toByteArray())).toString(16).padStart(32, '0')

0 commit comments

Comments
 (0)