Fixed typo
[advent-of-code-15.git] / advent04.ipynb
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {
7 "collapsed": true
8 },
9 "outputs": [],
10 "source": [
11 "import hashlib"
12 ]
13 },
14 {
15 "cell_type": "code",
16 "execution_count": 2,
17 "metadata": {
18 "collapsed": false
19 },
20 "outputs": [
21 {
22 "data": {
23 "text/plain": [
24 "'000001dbbfa3a5c83a2d506429c7b00e'"
25 ]
26 },
27 "execution_count": 2,
28 "metadata": {},
29 "output_type": "execute_result"
30 }
31 ],
32 "source": [
33 "hashlib.md5(b\"abcdef609043\").hexdigest()"
34 ]
35 },
36 {
37 "cell_type": "code",
38 "execution_count": 3,
39 "metadata": {
40 "collapsed": false
41 },
42 "outputs": [
43 {
44 "data": {
45 "text/plain": [
46 "53"
47 ]
48 },
49 "execution_count": 3,
50 "metadata": {},
51 "output_type": "execute_result"
52 }
53 ],
54 "source": [
55 "bytes(str(75), 'ascii')[1]"
56 ]
57 },
58 {
59 "cell_type": "code",
60 "execution_count": 4,
61 "metadata": {
62 "collapsed": false
63 },
64 "outputs": [
65 {
66 "data": {
67 "text/plain": [
68 "346386"
69 ]
70 },
71 "execution_count": 4,
72 "metadata": {},
73 "output_type": "execute_result"
74 }
75 ],
76 "source": [
77 "i = 0\n",
78 "salt = b\"iwrupvqb\"\n",
79 "hd = hashlib.md5(salt + bytes(str(i), 'ascii')).hexdigest()\n",
80 "while not hd.startswith('00000'):\n",
81 " i+=1\n",
82 " hd = hashlib.md5(salt + bytes(str(i), 'ascii')).hexdigest()\n",
83 "i"
84 ]
85 },
86 {
87 "cell_type": "code",
88 "execution_count": 5,
89 "metadata": {
90 "collapsed": false
91 },
92 "outputs": [
93 {
94 "data": {
95 "text/plain": [
96 "9958218"
97 ]
98 },
99 "execution_count": 5,
100 "metadata": {},
101 "output_type": "execute_result"
102 }
103 ],
104 "source": [
105 "i = 0\n",
106 "salt = b\"iwrupvqb\"\n",
107 "hd = hashlib.md5(salt + bytes(str(i), 'ascii')).hexdigest()\n",
108 "while not hd.startswith('000000'):\n",
109 " i+=1\n",
110 " hd = hashlib.md5(salt + bytes(str(i), 'ascii')).hexdigest()\n",
111 "i"
112 ]
113 },
114 {
115 "cell_type": "code",
116 "execution_count": null,
117 "metadata": {
118 "collapsed": true
119 },
120 "outputs": [],
121 "source": []
122 }
123 ],
124 "metadata": {
125 "kernelspec": {
126 "display_name": "Python 3",
127 "language": "python",
128 "name": "python3"
129 },
130 "language_info": {
131 "codemirror_mode": {
132 "name": "ipython",
133 "version": 3
134 },
135 "file_extension": ".py",
136 "mimetype": "text/x-python",
137 "name": "python",
138 "nbconvert_exporter": "python",
139 "pygments_lexer": "ipython3",
140 "version": "3.4.3"
141 }
142 },
143 "nbformat": 4,
144 "nbformat_minor": 0
145 }