Skip to content

Commit 43a8908

Browse files
committed
update day 4 2015 to be newline aware
1 parent b9420f3 commit 43a8908

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

inputs/2015/4.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ckczppom
1+
ckczppom

src/2015/4.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn run(input: aoc.Input) !aoc.Output {
1111
var part2found: bool = false;
1212

1313
var input_hash = Md5.init(.{});
14-
input_hash.update(input);
14+
input_hash.update(input[0..if (input[input.len-1] == '\n') input.len - 1 else input.len]);
1515
while (true) {
1616
var buf align(16) = [_]u8{undefined} ** 8;
1717
var out align(16) = [_]u8{undefined} ** 16;
@@ -37,6 +37,6 @@ pub fn run(input: aoc.Input) !aoc.Output {
3737

3838
test "2015-4" {
3939
// currently disabled because they're so slow
40-
try aoc.testPart1(609043, run("abcdef"));
40+
try aoc.testPart1(609043, run("abcdef\n"));
4141
try aoc.testPart1(1048970, run("pqrstuv"));
4242
}

0 commit comments

Comments
 (0)