VIDEO ENCRYPTION

7 visualizzazioni (ultimi 30 giorni)
LOKESH
LOKESH il 10 Apr 2012
Modificato: Walter Roberson il 19 Mar 2023
Presently I need any code for video encryption in matlab.any method!!video format .mpg

Risposte (2)

Walter Roberson
Walter Roberson il 10 Apr 2012
Caesar Cypher the frames.
  2 Commenti
LOKESH
LOKESH il 13 Apr 2012
I have avi or mpg video. I am extracting the frames. Do I need to save these frames as images & then perform encryption as images.
Also how could I convert the images back to video...
Thanks!!
Walter Roberson
Walter Roberson il 13 Apr 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.

Accedi per commentare.


dharmavarapu yugandhar kumar
Modificato: Walter Roberson il 19 Mar 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

Categorie

Scopri di più su Encryption / Cryptography in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by