Function advent_solutions::advent2017::day10::part2
[−]
[src]
pub fn part2(input: &str) -> String
Finally, the standard way to represent a Knot Hash is as a single
hexadecimal string; the final output is the dense hash in hexadecimal
notation. Because each number in your dense hash will be between 0 and
255 (inclusive), always represent each number as two hexadecimal
digits (including a leading zero as necessary). So, if your first three
numbers are 64, 7, 255, they correspond to the hexadecimal numbers
40, 07, ff, and so the first six characters of the hash would be
4007ff. Because every Knot Hash is sixteen such numbers, the
hexadecimal representation is always 32 hexadecimal digits (0-f)
long.
Here are some example hashes:
- The empty string becomes
a2582a3a0e66e6e86e3812dcb672a272.
assert_eq!(part2(""), "a2582a3a0e66e6e86e3812dcb672a272");
-
AoC 2017becomes33efeb34ea91902bb2f59c9920caa6cd.
assert_eq!(part2("AoC 2017"), "33efeb34ea91902bb2f59c9920caa6cd");
-
1,2,3becomes3efbe78a8d82f29979031a4aa0b16a9d.
assert_eq!(part2("1,2,3"), "3efbe78a8d82f29979031a4aa0b16a9d");
-
1,2,4becomes63960835bcdc130f0b66d7ff4f6a5a8e.
assert_eq!(part2("1,2,4"), "63960835bcdc130f0b66d7ff4f6a5a8e");
Treating your puzzle input as a string of ASCII characters, what is the Knot Hash of your puzzle input? Ignore any leading or trailing whitespace you might encounter.