block-cipher

encrypt-decrypt single block with AES and Crypto++

戏子无情 提交于 2019-12-01 21:13:45
问题 I need to encrypt single block of AES. I cant use any modes like CBC and other. Every example what i have seen use streaming modes. EDIT: ok, i did it in the next manner, but i really dislike this try. void dec(const byte *key, const byte* xblock, const byte *cipher, byte *plain) { AESDecryption d; try { const NameValuePairs &nvp = MakeParameters("", 0); d.UncheckedSetKey(key, 16, nvp); d.ProcessAndXorBlock(cipher, xblock, plain); } catch(...) {} } 回答1: AES in ECB mode is identical to single

Source and importance of nonce / IV for protocol using AES-GCM

你离开我真会死。 提交于 2019-11-29 03:45:57
I am making a protocol that uses packets (i.e., not a stream) encrypted with AES. I've decided on using GCM (based off CTR) because it provides integrated authentication and is part of the NSA's Suite B. The AES keys are negotiated using ECDH, where the public keys are signed by trusted contacts as a part of a web-of-trust using something like ECDSA. I believe that I need a 128-bit nonce / initialization vector for GCM because even though I'm using a 256 bit key for AES, it's always a 128 bit block cipher (right?) I'll be using a 96 bit IV after reading the BC code. I'm definitely not

Symmetric Bijective Algorithm for Integers

帅比萌擦擦* 提交于 2019-11-27 06:58:31
I need an algorithm that can do a one-to-one mapping (ie. no collision) of a 32-bit signed integer onto another 32-bit signed integer. My real concern is enough entropy so that the output of the function appears to be random. Basically I am looking for a cipher similar to XOR Cipher but that can generate more arbitrary-looking outputs. Security is not my real concern, although obscurity is. Edit for clarification purpose: The algorithm must be symetric, so that I can reverse the operation without a keypair. The algorithm must be bijective, every 32-bit input number must generate a 32-bit

Symmetric Bijective Algorithm for Integers

余生颓废 提交于 2019-11-26 13:00:03
问题 I need an algorithm that can do a one-to-one mapping (ie. no collision) of a 32-bit signed integer onto another 32-bit signed integer. My real concern is enough entropy so that the output of the function appears to be random. Basically I am looking for a cipher similar to XOR Cipher but that can generate more arbitrary-looking outputs. Security is not my real concern, although obscurity is. Edit for clarification purpose: The algorithm must be symetric, so that I can reverse the operation