Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

New answers tagged

1

OFB converts a block cipher to a stream cipher (As does CTR mode). The plain text or any derivitive from it never enters the block cipher. The key stream is unrelated to what is being encrypted. The final ciphertext is just a xor of the plain text with the key stream and the key stream depends only on secret key and IV. reuse both and you get the same key ...


3

Question: is it safe to use the DERIVED key, where the ORIGINAL key is the same, but the salt is different every time? No, but the reason is a little tricky. First, forget AES-CBC—you should use an authenticated cipher like AES-GCM (if you must use AES) or NaCl crypto_secretbox_xsalsa20poly1305, and focus on the security contract. AES-CBC is hard to use ...


2

For key derivation use PBKDF2, Bcrypt, Scrypt, or better use Argon2id. Argon was the winner of the Password Hashing Competition question: is it safe to use the DERIVED key , where the ORIGINAL key is the same, but the salt is different every time? If you use a different randomly generated salt, you will be fine. You can also append a counter to the ...


1

I want to know if the following would also be equally secure Yes, both schemes are equally secure. Also for what you are trying to achieve you really shouldn't puzzle things together yourself but rather use pre-made modes like AES-GCM, AES-EAX or ChaCha20-Poly1305. In fact, we can prove the above claimed security equivalence. Because Encrypt-then-MACis ...


1

However, if your message is exactly 128 bits long, do you only perform the XOR with the IV and the encryption with the key once? Or is there a way to split up a 128 bit message so that you can perform the cipher block chaining method as intended. This is a non-starter, as there is nothing wrong with performing a single block encrypt in CBC mode. For 128 ...


0

Firstly, you need to apply a padding scheme like PKCS#5 or PKCS#7 so that your message will be always a multiple of 128. A 128-bit message than will be two-block. However, if you have one byte less than the block size, you will have 128-bit messages this means that you have one block. After the padding, you can encrypt with CBC mode. The first block will ...


0

A standard way to encrypt a message is to apply some sort of padding (PKCS #7 for instance), that converts messages of arbitrary length to a set of fixed-size plaintext blocks (16 bytes in case of AES-128). If your properly padded message is contained in one block only, you just encrypt that block. CBC and other modes of block cipher operation do not ...


2

The requirements differ per mode of operation. AES itself is a block cipher, and as block cipher, it doesn't take an IV at all. Tweakable block ciphers may take a tweak, which may have some overlap with an IV, but AES isn't tweakable by itself. CBC requires an unpredictable IV (to the adversary). One of the common ways is indeed to generate a 16 byte (one ...


Top 50 recent answers are included