VIDEO ENCRYPTION
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Presently I need any code for video encryption in matlab.any method!!video format .mpg
0 comentarios
Respuestas (2)
Walter Roberson
el 10 de Abr. de 2012
Caesar Cypher the frames.
2 comentarios
Walter Roberson
el 13 de Abr. de 2012
When you extract a frame, you will get an array of data as the result. Encrypt that array. Use VideoWriter() to write the frame to a new video.
dharmavarapu yugandhar kumar
el 29 de Abr. de 2021
Editada: Walter Roberson
el 19 de Mzo. de 2023
classdef AES < handle
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties (Access = private)
secretKey
cipher
end
methods
function obj = AES(secret, algorithm)
%AES Construct an instance of this class
% algorithm options are https://docs.oracle.com/javase/9/docs/specs/security/standard-names.html#messagedigest-algorithms
import java.security.MessageDigest;
import java.lang.String;
import java.util.Arrays;
import javax.crypto.Cipher;
key = String(secret).getBytes("UTF-8");
sha = MessageDigest.getInstance(algorithm);
key = sha.digest(key);
key = Arrays.copyOf(key, 16);
obj.secretKey = javaObject('javax.crypto.spec.SecretKeySpec',key, "AES");
obj.cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
end
function encrypted = encrypt(obj, strToEncrypt)
%ENCRYPT Summary of this method goes here
% Detailed explanation goes here
import java.util.Base64;
import java.lang.String;
import javax.crypto.Cipher;
obj.cipher.init(Cipher.ENCRYPT_MODE, obj.secretKey);
encrypted = string(Base64.getEncoder().encodeToString(obj.cipher.doFinal(String(strToEncrypt).getBytes("UTF-8"))));
end
function encrypted = encryptStructuredData(obj, structuredData)
encrypted = obj.encrypt(jsonencode(structuredData));
end
function decrypted = decryptStructuredData(obj, encryptedStructuredData)
decrypted = jsondecode(obj.decrypt(encryptedStructuredData));
end
function decrypted = decrypt(obj, strToDecrypt)
%DECRYPT Summary of this method goes here
% Detailed explanation goes here
import javax.crypto.Cipher;
import java.lang.String;
import java.util.Base64;
obj.cipher.init(Cipher.DECRYPT_MODE, obj.secretKey);
decrypted = string(String(obj.cipher.doFinal(Base64.getDecoder().decode(strToDecrypt))));
end
end
end
0 comentarios
Ver también
Categorías
Más información sobre Encryption / Cryptography en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!