Questions tagged [ecb]

ECB (Electronic Code Book) is a degenerate mode of operation for block ciphers.

Electronic Codebook mode (ECB) is a mode of operation for block ciphers that involves dividing the message into blocks and encrypting each block independently.

ECB mode encryption

It is the simplest mode of operation, but is considered very weak. Identical plaintext blocks are encrypted into identical ciphertext blocks, which makes it easy for an attacker to circumvent its security. As such, it is not recommended to be used for any secure system. Instead, a secure mode such as Cipher-Block Chaining (CBC) or Counter (CTR) mode should be chosen.

Why ECB is not secure?

ECB is not semantically secure because identical blocks of plaintext will be encrypted to the same ciphertext block. This vulnerability helps the attacker to find out plaintext patterns.

141 questions
0
votes
0 answers

C - OpenSSL AES Encryption key issue

I'm porting an AES encryption procedure from Javascript to C. I'm using OpenSSL. For the encryption I'm using ECB 256 mode. The encryption goes successfully but the final Base64 does not correspond to the result I get in JS. By testing with several…
Xayris
  • 47
  • 7
0
votes
0 answers

Error 'IV not meaningful' while encrypting an Image using ECB, CBC and CFB modes in python

Please i'm trying to encrypt an image using the ECB, CBC and CFB modes. when I try to execute the program, i get the error "TypeError: IV is not meaningful for the ECB mode". Here is my code: I will really appreciate any help as am new to python.…
Amaka
  • 13
  • 4
0
votes
1 answer

Encrypting With CryptoJS

I am trying to use the CryptoJS library to get the same value as I'm getting from an encryption tool, but I'm not able to get the same encrypted value. Result using encryption tool: Base64 Encoded Key:…
sqone2
  • 31
  • 1
  • 1
  • 5
0
votes
1 answer

Encrypt hex using AES128-ECB and maintain big endian in javascript/node

I am trying to encrypt hex using AES128-ECB using the Big Endian protocol. I know that ECB is not secure but it is something that I need to use to connect with a Bluetooth application. I am building a React-Native application that will connect to a…
user12403650
  • 49
  • 1
  • 2
0
votes
0 answers

openssl not producing messages of expected size

I have a 16 byte file, and after encrypting it, its size weirdly changes. > hexdump -C 1.txt 00000000 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 |aaaaaaaaaaaaaaa| 0000000f > openssl enc -v -aes-128-ecb -nosalt -base64 -in 1.txt -out…
Donald
  • 693
  • 1
  • 7
  • 12
0
votes
1 answer

C# DES ECB Encryption OpenSSL

I am having a problem getting my encryption to match what I am getting out of OpenSSL. The input in the Mk.bin file is a hex value of CA46E5A885D1E016150B5B64ECC11A43 The following is my openssl command: openssl.exe enc -des-ecb -in…
0
votes
1 answer

How to convert Java AES ECB Encryption Code to Nodejs

I have code in java for encryption public String encrypt() throws Exception { String data = "Hello World"; String secretKey = "j3u8ue8xmrhsth59"; byte[] keyValue = secretKey.getBytes(); Key key = new SecretKeySpec(keyValue, "AES"); …
Abhishek Kumar
  • 2,136
  • 3
  • 24
  • 36
0
votes
1 answer

AES 256 ECB decyption with valid key returns strange/characters

I am trying to decrypt in PHP using functions openssl_decrypt. The problem is that part of the string that is returned is correct but part of is gibberish `@M{-Y f{5678","token":null}` Any kind of help will be appreciated First I though it was an…
0
votes
0 answers

AES encryption with CipherMode.ECB

I need help to get my C# AES encryption running. In my example I have the plaintext, the key, and the result. In an online tool called http://aes.online-domain-tools.com/ it works fine. At least I know that I have to use the CipherMode.ECB. …
alex
  • 1
  • 1
0
votes
1 answer

The input data is not a complete block when reading stream of bytes in POST data

I have a web service where I am reading a stream of data from a POST request. But when I read it from the Request.InputStream, it gives me error saying "The input data is not a complete block." However, when I try to read it from a file that was…
0
votes
0 answers

Client-server communication and encryption/decryption

I am implementing a website in C# and I have a client server communication that I need to carry out. Client would send (POST) encrypted data and server would read the data and response with encrypted response. The encryption that we are using is…
0
votes
1 answer

PHP Decrypt data (encrypted with mcrypt) using openssl

I have a database full of data encrypted in 3DES (ECB) that was encrypted with the php Mcrypt library. Since Mcrypt is depreacated, I need to switch to OpenSSL to decrypt it. All the data will be reencrypted using xchacha20-poly1305-ietf. So I don't…
Ian Lord
  • 21
  • 1
  • 3
0
votes
1 answer

How to port DES ECB encryption from Python to Ruby

I am trying to rewrite an encryption function from python to ruby, but not getting the same result. I know des ecb is insecure and not recommended, but is needed for the purpose of this porting from python and ruby. Using pyDes in python, I have the…
Brett
  • 5,690
  • 6
  • 36
  • 63
0
votes
1 answer

How to encrypt with Twofish using ECB cipher mode and PKCS7 block padding mode?

I want to access an API with PHP. The specifications are: Twofish algorithm ECB cipher mode PKCS7 block padding mode I have tried a lot of different PHP functions and libraries, but none seems to work. Here is my code: function encrypt($data,…
malisokan
  • 5,362
  • 2
  • 20
  • 19
0
votes
0 answers

TRIPLE DES ECB Encryption RUBY

I have a sample code in .NET C# which I need to convert to RUBY. public static string Encrypt(string pstrText) { byte[] keyArray; byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(pstrText); …
Rajat Suneja
  • 494
  • 2
  • 10
  • 27