Data Structures | |
class | AESKey |
class | Chk |
Functions | |
def | encode_data_to_string (data) |
def | sha512_hash (data) |
def | setup_aes_cipher_ (aes_key) |
def | aes_pad_ (data) |
def | aes_encrypt (aes_key, data) |
def | aes_decrypt (aes_key, data) |
def | compute_depth_ (size) |
def | compute_tree_size_ (depth) |
def | compute_chk_offset_ (depth, end_offset) |
def | compute_iblock_size_ (depth, offset) |
def | compute_rootchk (readin, size) |
def | chkuri_from_path (path) |
def | usage () |
Variables | |
tuple | DBLOCK_SIZE = (32 * 1024) |
int | CHK_PER_INODE = 256 |
int | CHK_HASH_SIZE = 64 |
int | CHK_QUERY_SIZE = CHK_HASH_SIZE |
string | GNUNET_FS_URI_PREFIX = "gnunet://fs/" |
string | GNUNET_FS_URI_CHK_INFIX = "chk/" |
opts | |
args | |
def gnunet-chk.encode_data_to_string | ( | data | ) |
Returns an ASCII encoding of the given data block like GNUNET_STRINGS_data_to_string() function. data: A bytearray representing the block of data which has to be encoded
Definition at line 50 of file gnunet-chk.py.
References GNUNET_STRINGS_data_to_string(), and type.
Referenced by gnunet-chk.Chk.uri().
def gnunet-chk.sha512_hash | ( | data | ) |
Returns the sha512 hash of the given data. data: string to hash
Definition at line 82 of file gnunet-chk.py.
Referenced by compute_rootchk().
def gnunet-chk.setup_aes_cipher_ | ( | aes_key | ) |
Initializes the AES object with settings similar to those in GNUnet. aes_key: the AESKey object Returns the newly initialized AES object
Definition at line 126 of file gnunet-chk.py.
Referenced by aes_decrypt(), and aes_encrypt().
def gnunet-chk.aes_pad_ | ( | data | ) |
Adds padding to the data such that the size of the data is a multiple of 16 bytes data: the data string Returns a tuple:(pad_len, data). pad_len denotes the number of bytes added as padding; data is the new data string with padded bytes at the end
Definition at line 135 of file gnunet-chk.py.
Referenced by aes_decrypt(), and aes_encrypt().
def gnunet-chk.aes_encrypt | ( | aes_key, | |
data | |||
) |
Encrypts the given data using AES. aes_key: the AESKey object to use for AES encryption data: the data string to encrypt
Definition at line 151 of file gnunet-chk.py.
References aes_pad_(), and setup_aes_cipher_().
Referenced by compute_rootchk().
def gnunet-chk.aes_decrypt | ( | aes_key, | |
data | |||
) |
Decrypts the given data using AES aes_key: the AESKey object to use for AES decryption data: the data string to decrypt
Definition at line 165 of file gnunet-chk.py.
References aes_pad_(), and setup_aes_cipher_().
def gnunet-chk.compute_depth_ | ( | size | ) |
Computes the depth of the hash tree. size: the size of the file whose tree's depth has to be computed Returns the depth of the tree. Always > 0.
Definition at line 204 of file gnunet-chk.py.
Referenced by compute_rootchk().
def gnunet-chk.compute_tree_size_ | ( | depth | ) |
Calculate how many bytes of payload a block tree of the given depth MAY correspond to at most (this function ignores the fact that some blocks will only be present partially due to the total file size cutting some blocks off at the end). depth: depth of the block. depth==0 is a DBLOCK. Returns the number of bytes of payload a subtree of this depth may correspond to.
Definition at line 220 of file gnunet-chk.py.
Referenced by compute_chk_offset_(), and compute_iblock_size_().
def gnunet-chk.compute_chk_offset_ | ( | depth, | |
end_offset | |||
) |
Compute the offset of the CHK for the current block in the IBlock above depth: depth of the IBlock in the tree (aka overall number of tree levels minus depth); 0 == DBLOCK end_offset: current offset in the overall file, at the *beginning* of the block for DBLOCK (depth == 0), otherwise at the *end* of the block (exclusive) Returns the offset in the list of CHKs in the above IBlock
Definition at line 236 of file gnunet-chk.py.
References compute_tree_size_().
Referenced by compute_rootchk().
def gnunet-chk.compute_iblock_size_ | ( | depth, | |
offset | |||
) |
Compute the size of the current IBLOCK. The encoder is triggering the calculation of the size of an IBLOCK at the *end* (hence end_offset) of its construction. The IBLOCK maybe a full or a partial IBLOCK, and this function is to calculate how long it should be. depth: depth of the IBlock in the tree, 0 would be a DBLOCK, must be > 0 (this function is for IBLOCKs only!) offset: current offset in the payload (!) of the overall file, must be > 0 (since this function is called at the end of a block). Returns the number of elements to be in the corresponding IBlock
Definition at line 254 of file gnunet-chk.py.
References compute_tree_size_().
Referenced by compute_rootchk().
def gnunet-chk.compute_rootchk | ( | readin, | |
size | |||
) |
Returns the content hash key after generating the hash tree for the given input stream. readin: the stream where to read data from size: the size of data to be read
Definition at line 280 of file gnunet-chk.py.
References aes_encrypt(), compute_chk_offset_(), compute_depth_(), compute_iblock_size_(), min, and sha512_hash().
Referenced by chkuri_from_path().
def gnunet-chk.chkuri_from_path | ( | path | ) |
Returns the CHK URI of the file at the given path. path: the path of the file whose CHK has to be calculated
Definition at line 343 of file gnunet-chk.py.
References compute_rootchk().
def gnunet-chk.usage | ( | ) |
Prints help about using this script.
Definition at line 355 of file gnunet-chk.py.
Referenced by dns_string_to_value().
tuple gnunet-chk.DBLOCK_SIZE = (32 * 1024) |
Definition at line 33 of file gnunet-chk.py.
int gnunet-chk.CHK_PER_INODE = 256 |
Definition at line 39 of file gnunet-chk.py.
int gnunet-chk.CHK_HASH_SIZE = 64 |
Definition at line 41 of file gnunet-chk.py.
int gnunet-chk.CHK_QUERY_SIZE = CHK_HASH_SIZE |
Definition at line 43 of file gnunet-chk.py.
string gnunet-chk.GNUNET_FS_URI_PREFIX = "gnunet://fs/" |
Definition at line 45 of file gnunet-chk.py.
string gnunet-chk.GNUNET_FS_URI_CHK_INFIX = "chk/" |
Definition at line 47 of file gnunet-chk.py.
gnunet-chk.opts |
Definition at line 370 of file gnunet-chk.py.
Referenced by OIDC_parse_authz_code(), set_listen_cb(), and task_start_reconcile().
gnunet-chk.args |
Definition at line 370 of file gnunet-chk.py.