aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.kt
blob: acfb72a21aee7166ac2514a1b2e3e85409eacf50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import java.io.File
import java.math.BigInteger
import java.security.MessageDigest

/**
 * Reads lines from the given input txt file.
 */
fun readInput(name: String) = File("src", "$name.txt").readLines()

/**
 * Converts string to md5 hash.
 */
fun String.md5(): String = BigInteger(1, MessageDigest.getInstance("MD5").digest(toByteArray())).toString(16)