Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapted to Python 3 #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Version Control.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,14 @@
{
"cell_type": "code",
"collapsed": false,
"input": [
"import sha\n",
"\n",
"# Our first commit\n",
"data1 = 'This is the start of my paper2.'\n",
"meta1 = 'date: 1/1/12'\n",
"hash1 = sha.sha(data1 + meta1).hexdigest()\n",
"print 'Hash:', hash1"
"input": [
"import hashlib\n",
"\n",
"# Our first commit\n",
"data1 = b'This is the start of my paper2.'\n",
"meta1 = b'date: 1/1/12'\n",
"hash1 = hashlib.sha1(data1+meta1).hexdigest().encode()\n",
"print('Hash:', hash1)"
],
"language": "python",
"metadata": {},
Expand All @@ -271,7 +271,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"Hash: 7bb695b77966e27cfaebfa59e27a0b91f1d33813\n"
"Hash: b'7bb695b77966e27cfaebfa59e27a0b91f1d33813'\n"
]
}
],
Expand All @@ -281,12 +281,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
"# Our second commit, linked to the first\n",
"data2 = 'Some more text in my paper...'\n",
"meta2 = 'date: 1/2/12'\n",
"# Note we add the parent hash here!\n",
"hash2 = sha.sha(data2 + meta2 + hash1).hexdigest()\n",
"print 'Hash:', hash2"
"# Our second commit, linked to the first\n",
"data2 = b'Some more text in my paper...'\n",
"meta2 = b'date: 1/2/12'\n",
"# Note we add the parent hash here!\n",
"hash2 = hashlib.sha1(data2 + meta2 + hash1).hexdigest().encode()\n",
"print('Hash:', hash2)"
],
"language": "python",
"metadata": {},
Expand All @@ -295,7 +295,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"Hash: 543da8bac9f643ba5611897b192a16dea42d2ab7\n"
"Hash: b'543da8bac9f643ba5611897b192a16dea42d2ab7'\n"
]
}
],
Expand Down