フィルターのクリア

Key-based matrix scrambling

3 ビュー (過去 30 日間)
Digitalsd
Digitalsd 2012 年 10 月 31 日
I have a matrix and I need to scramble its elements in a reversible way using a key based function.It could be a key based permutation. The question: Are there any built-in MATLAB functions or libraries that could help me to perform such operation? any suggestions?

採用された回答

Jan
Jan 2012 年 10 月 31 日
編集済み: Jan 2012 年 10 月 31 日
data = rand(1, 128);
key = 12654;
stream0 = RandStream('mt19937ar', 'Seed', key);
RandStream.setDefaultStream(stream0);
index = randperm(128);
scrambled = data(index);
unscrambled = zeros(1, numel(data));
unscrambled(index) = scrambled;
isequal(data, unscrambled)
This is not tested yet.
  2 件のコメント
Digitalsd
Digitalsd 2012 年 11 月 1 日
The question’s point : if I send you a key-based scrambled matrix, you will be able to extract the original matrix using the same key (symmetric key). If the codes in lines 3 and 4 will force the ‘randperm’ in line 5 to give me the same ‘index‘ permutation when using the same key, I will reach the point. !?
Digitalsd
Digitalsd 2012 年 11 月 2 日
has been tested, works correctly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by