adventofcode/2016/day07/problem

81 lines
3.0 KiB
Plaintext
Raw Normal View History

2016-12-07 13:54:13 +00:00
Advent of Code
--- Day 7: Internet Protocol Version 7 ---
2018-03-15 16:24:23 +00:00
While snooping around the local network of EBHQ, you compile a list of IP
addresses (they're IPv7, of course; IPv6 is much too limited). You'd like to
figure out which IPs support TLS (transport-layer snooping).
2016-12-07 13:54:13 +00:00
2018-03-15 16:24:23 +00:00
An IP supports TLS if it has an Autonomous Bridge Bypass Annotation, or
ABBA. An ABBA is any four-character sequence which consists of a pair of two
different characters followed by the reverse of that pair, such as xyyx or
abba. However, the IP also must not have an ABBA within any hypernet
sequences, which are contained by square brackets.
2016-12-07 13:54:13 +00:00
For example:
 abba[mnop]qrst supports TLS (abba outside square brackets).
2018-03-15 16:24:23 +00:00
 abcd[bddb]xyyx does not support TLS (bddb is within square brackets,
even though xyyx is outside square brackets).
 aaaa[qwer]tyui does not support TLS (aaaa is invalid; the interior
characters must be different).
 ioxxoj[asdfgh]zxcvbn supports TLS (oxxo is outside square brackets, even
though it's within a larger string).
2016-12-07 13:54:13 +00:00
How many IPs in your puzzle input support TLS?
2018-03-15 16:24:23 +00:00
Your puzzle answer was 118.
2016-12-07 13:54:13 +00:00
--- Part Two ---
You would also like to know which IPs support SSL (super-secret listening).
2018-03-15 16:24:23 +00:00
An IP supports SSL if it has an Area-Broadcast Accessor, or ABA, anywhere in
the supernet sequences (outside any square bracketed sections), and a
corresponding Byte Allocation Block, or BAB, anywhere in the hypernet
sequences. An ABA is any three-character sequence which consists of the same
character twice with a different character between them, such as xyx or aba.
A corresponding BAB is the same characters but in reversed positions: yxy
and bab, respectively.
2016-12-07 13:54:13 +00:00
For example:
2018-03-15 16:24:23 +00:00
 aba[bab]xyz supports SSL (aba outside square brackets with corresponding
bab within square brackets).
2016-12-07 13:54:13 +00:00
 xyx[xyx]xyx does not support SSL (xyx, but no corresponding yxy).
2018-03-15 16:24:23 +00:00
 aaa[kek]eke supports SSL (eke in supernet with corresponding kek in
hypernet; the aaa sequence is not related, because the interior character
must be different).
 zazbz[bzb]cdb supports SSL (zaz has no corresponding aza, but zbz has a
corresponding bzb, even though zaz and zbz overlap).
2016-12-07 13:54:13 +00:00
How many IPs in your puzzle input support SSL?
2018-03-15 16:24:23 +00:00
Your puzzle answer was 260.
2016-12-07 13:54:13 +00:00
References
Visible links
. http://adventofcode.com/
. http://adventofcode.com/2016/about
. http://adventofcode.com/2016/support
. http://adventofcode.com/2016/events
. http://adventofcode.com/2016/settings
. http://adventofcode.com/2016/auth/logout
. http://adventofcode.com/2016
. http://adventofcode.com/2016
. http://adventofcode.com/2016/leaderboard
. http://adventofcode.com/2016/stats
. http://adventofcode.com/2016/sponsors
. http://adventofcode.com/2016/sponsors
. https://en.wikipedia.org/wiki/IP_address
. https://en.wikipedia.org/wiki/IPv6
. http://adventofcode.com/2016
. http://adventofcode.com/2016/day/7/input