File: timestamp.py

package info (click to toggle)
python-opentimestamps 0.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 340 kB
  • sloc: python: 1,764; sh: 16; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (C) 2016 The OpenTimestamps developers
#
# This file is part of python-opentimestamps.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-opentimestamps including this file, may be copied,
# modified, propagated, or distributed except according to the terms contained
# in the LICENSE file.

"""Convenience functions for creating timestamps"""

import os

from opentimestamps.core.op import OpAppend, OpSHA256

def nonce_timestamp(private_timestamp, crypt_op=OpSHA256(), length=16):
    """Create a nonced version of a timestamp for privacy"""
    stamp2 = private_timestamp.ops.add(OpAppend(os.urandom(length)))
    return stamp2.ops.add(crypt_op)