Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start of command line client.
  • Loading branch information
petertodd committed Jun 9, 2012
1 parent 3d1013a commit 6e2519d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
@@ -1,3 +1,8 @@
# OpenTimestamps

A hash-chain-based timestamping system.

# Requirements

Python (>=2.7.0)
PyCrypto (>=0.5)
47 changes: 47 additions & 0 deletions ots
@@ -0,0 +1,47 @@
#!/usr/bin/python
# Copyright (C) 2012 Peter Todd <pete@petertodd.org>
#
# This file is part of OpenTimestamps.
#
# OpenTimestamps is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys
if sys.version_info[1] < 7:
sys.exit("OpenTimestamps requires Python version 2.7.0 or newer. "\
"(you have %d.%d.%d)"%sys.version_info[0:3])

import Crypto.Hash.SHA256 as chash
import argparse

parser = argparse.ArgumentParser(description="OpenTimestamps client")
verbosity_group = parser.add_mutually_exclusive_group()
verbosity_group.add_argument("-v","--verbose",action="store_true",
help="be verbose")
verbosity_group.add_argument("-q","--quiet",action="store_true",
help="be quiet")

args = parser.parse_args()

print 'args: ',args

h = chash.new()

in_fd = sys.stdin

while True:
d = in_fd.read(4096)
if d == '':
break
h.update(d)
print h.hexdigest()

0 comments on commit 6e2519d

Please sign in to comment.