VIDEO ENCRYPTION
6 ビュー (過去 30 日間)
古いコメントを表示
Presently I need any code for video encryption in matlab.any method!!video format .mpg
0 件のコメント
回答 (2 件)
Walter Roberson
2012 年 4 月 10 日
Caesar Cypher the frames.
2 件のコメント
Walter Roberson
2012 年 4 月 13 日
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
2021 年 4 月 29 日
編集済み: Walter Roberson
2023 年 3 月 19 日
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 件のコメント
参考
カテゴリ
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!