Suggest me the best image encryption algorithm
조회 수: 5 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
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(:))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!