Questions tagged [block-cipher]

A block cipher is a keyed bijective function (also pseudo-random permutation). If your question is not directly related to programming, check if the question fits better on https://crypto.stackexchange.com/ or https://security.stackexchange.com/

121 questions
33
votes
11 answers

Symmetric Bijective Algorithm for Integers

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…
Emre Yazici
  • 9,708
  • 6
  • 46
  • 54
17
votes
4 answers

How to detect block cipher mode

How to detect if a message was crypt by CBC or ECB mode? I have made a function who encrypt in AES 128 CBC or ECB randomly, and I do hamming between clear text and cipher text, but seams not correlated to cipher mode. How can I detect the block…
Xantra
  • 223
  • 1
  • 3
  • 8
14
votes
2 answers

What is the default IV when encrypting with aes_256_cbc cipher?

I've generated a random 256 bit symmetric key, in a file, to use for encrypting some data using the OpenSSL command line which I need to decrypt later programmatically using the OpenSSL library. I'm not having success, and I think the problem might…
Steve
  • 6,085
  • 2
  • 35
  • 62
12
votes
2 answers

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

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,…
Hut8
  • 5,710
  • 1
  • 35
  • 51
8
votes
1 answer

Anyone with a C#, Delphi or FreePascal implementation of the PRESENT Ultra-Lightweight Block Cipher encryption?

A short while ago a paper got published on PRESENT: An Ultra-Lightweight Block Cipher by Andrey Bogdanov et al becoming ISO standard 29192-2:2012. Is there anyone that has a C#, Delphi or FreePascal implementation with unit tests? This was asked…
Gustavo Carreno
  • 8,809
  • 13
  • 42
  • 72
8
votes
3 answers

CTR mode use of Initial Vector(IV)

from what I know, CTR mode doesn't use an Initial Vector. It just takes a counter, encrypts it with a given key and then XOR's the result with the plaintext in order to get the ciphertext. Other block cipher modes like CBC before doing the…
Antonys
  • 83
  • 1
  • 3
6
votes
1 answer

Is this AES encryption secure enough?

I got this code from http://www.ravenblast.com/index.php/blog/android-password-text-encryption/ and, although it works, I have a growing suspicion it's not secure enough. There isn't any initialization vector which seems to be necessary according…
user2083242
  • 63
  • 1
  • 5
5
votes
1 answer

How does libgcrypt increment the counter for CTR mode?

I have a file encrypted with AES-256 using libgcrypt's CTR mode implementation. I want to be able to decrypt the file in parts (e.g. decrypting blocks 5-10 out of 20 blocks without decrypting the whole file). I know that by using CTR mode, I should…
E1adi
  • 65
  • 4
5
votes
2 answers

How to encrypt files with AES256-GCM in golang?

AES256-GCM could be implemented in go as https://gist.github.com/cannium/c167a19030f2a3c6adbb5a5174bea3ff However, Seal method of interface cipher.AEAD has signature: Seal(dst, nonce, plaintext, additionalData []byte) []byte So for very large…
can.
  • 1,798
  • 7
  • 26
  • 38
5
votes
1 answer

ECB, CFB, OFB cipher modes in Openssl

I know that when I use CBC mode with Openssl, I can give as an input which is a multiple of a block size. But how about other modes? ECB, CFB, OFB? I saw a doc but its not all clear to me. Should I call them in a loop? Lets say, ECB. It encrypts 64…
ivy
  • 1,255
  • 3
  • 14
  • 20
4
votes
1 answer

Midori128 incorrect ciphertext

I have a project in which I must implement a variety of Security Protocols for my Arduino Uno R3, such as Present, Misty, Prince, and so on. At the moment I am attempting to implement Midori128. I managed to get Midiori64 to work properly, but for…
Omar-UniMA
  • 41
  • 4
4
votes
2 answers

Using Coldfusion's Encrypt function to encrypt a hex block and return a block-length result

My company is working on a project that will put card readers in the field. The readers use DUKPT TripleDES encryption, so we will need to develop software that will decrypt the card data on our servers. I have just started to scratch the surface on…
4
votes
1 answer

Crypto++ symmetric algorithms and authenticated block modes combinations

I've implemented a C++ wrapper library for Crypto++ v5.6.2 and have a question about combinations of symmetric algorithms (e. g. Blowfish) and block modes (e. g. GCM). I am able to encrypt and decrypt data via Blowfish/EAX, but I can't achieve the…
Florian Wolters
  • 3,273
  • 3
  • 25
  • 47
4
votes
1 answer

encrypt-decrypt single block with AES and Crypto++

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,…
Yola
  • 16,575
  • 11
  • 57
  • 92
3
votes
1 answer

How to perform addition modulo 2 to the power 64

I want to perform addition modulo 2 to the power 64 between p1 and p2 using MATLAB. Both p1 and p2 are of type uint64. Is the following code correct? c1 = p1 + p2; if (c1> 2^64) c1 = c1 - 2^64; end
Naseem
  • 39
  • 5
1
2 3
8 9