필터 지우기
필터 지우기

Suggest me the best image encryption algorithm

조회 수: 10 (최근 30일)
Gottumukkala Sai
Gottumukkala Sai 2021년 8월 24일
편집: Jan 2021년 8월 24일
Hi I am Sai and I am looking for an image encryption algorithm that is
Priority 1 : Light (Less time consuming) and
Priority 2 : Efficient (Strong)
Please help me with your suggestions.
Thanks in advance!

답변 (1개)

Jan
Jan 2021년 8월 24일
편집: Jan 2021년 8월 24일
A short answer: AES-CBC.
An implementation:
key = uint8('myPassword');
data = randi([0, 255], 640, 480, 3, 'uint8');
% Get a 16 byte hash from the password:
Hashing = java.security.MessageDigest.getInstance('MD5');
Hashing.update(key);
Hash = typecast(Hashing.digest, 'uint8');
% Set up algorithm:
Engine = javax.crypto.spec.SecretKeySpec(Hash, 'AES');
Cipher = javax.crypto.Cipher.getInstance('AES/CBC/PKCS5Padding');
% Encrypt:
Cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, Engine);
encrypted = typecast(Cipher.doFinal(data(:)), 'uint8');
% Decrypt:
Cipher.init(javax.crypto.Cipher.DECRYPT_MODE, Engine);
decrypted = typecast(Cipher.doFinal(encrypted(:)), 'uint8');
% Compare the results - of course the shape of the array has not been
% considered yet:
isequal(decrypted(:), data(:))
ans = logical
1

카테고리

Help CenterFile Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by