コード例 #1
0
ファイル: symenckey.py プロジェクト: jimktrains/freebooks
 def to_dict(self, pickle_key):
     s = SymEnc(pickle_key)
     return {
         'algo': self.algo,
         'mode': self.mode, 
         'block_size': self.block_size,
         'encrypt': s.encrypt(self.encrypt).to_dict(),
         'hmac': s.encrypt(self.hmac).to_dict()
     }
コード例 #2
0
ファイル: ledger.py プロジェクト: jimktrains/freebooks
    def create_tx(self, from_account, to_account, description, amount):
        self.check_key()

        encor = SymEnc(self.key)
        description = encor.encrypt(description)
        amount = encor.encrypt(str(amount))

        tx = {
            'description': description.to_dict(),
            'amount': amount.to_dict(),
            'to_account': to_account,
            'from_account': from_account,
        }

        tx_yaml = yaml.dump(tx, default_flow_style = False)
        self.commit('txs',"Added Tx", data=tx_yaml)