Skip to content

Commit 6e2519d

Browse files
committed
Start of command line client.
1 parent 3d1013a commit 6e2519d

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# OpenTimestamps
22

33
A hash-chain-based timestamping system.
4+
5+
# Requirements
6+
7+
Python (>=2.7.0)
8+
PyCrypto (>=0.5)

ots

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/python
2+
# Copyright (C) 2012 Peter Todd <pete@petertodd.org>
3+
#
4+
# This file is part of OpenTimestamps.
5+
#
6+
# OpenTimestamps is free software; you can redistribute it and/or modify it
7+
# under the terms of the GNU Affero General Public License as published by the
8+
# Free Software Foundation; either version 3 of the License, or (at your
9+
# option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13+
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
14+
# details.
15+
#
16+
# You should have received a copy of the GNU Affero General Public License
17+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
import sys
20+
if sys.version_info[1] < 7:
21+
sys.exit("OpenTimestamps requires Python version 2.7.0 or newer. "\
22+
"(you have %d.%d.%d)"%sys.version_info[0:3])
23+
24+
import Crypto.Hash.SHA256 as chash
25+
import argparse
26+
27+
parser = argparse.ArgumentParser(description="OpenTimestamps client")
28+
verbosity_group = parser.add_mutually_exclusive_group()
29+
verbosity_group.add_argument("-v","--verbose",action="store_true",
30+
help="be verbose")
31+
verbosity_group.add_argument("-q","--quiet",action="store_true",
32+
help="be quiet")
33+
34+
args = parser.parse_args()
35+
36+
print 'args: ',args
37+
38+
h = chash.new()
39+
40+
in_fd = sys.stdin
41+
42+
while True:
43+
d = in_fd.read(4096)
44+
if d == '':
45+
break
46+
h.update(d)
47+
print h.hexdigest()

0 commit comments

Comments
 (0)