-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageKeyGenerator.m
More file actions
36 lines (36 loc) · 1.58 KB
/
ImageKeyGenerator.m
File metadata and controls
36 lines (36 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function ImgKey=ImageKeyGenerator(OrgImg)
[rows,coloumns,map]=size(OrgImg);
[cutdImg,cutrlgc]=imageCutter(OrgImg);
scramImg=randPermutator(OrgImg);
[rotatedLeft,rotatedRight,rotatedDown]=rotator(cutdImg);
rotatedLeft=catenator(rotatedLeft,cutrlgc);
rotatedRight=catenator(rotatedRight,cutrlgc);
rotatedDown=catenator(rotatedDown,cutrlgc);
scramLeft=randPermutator(rotatedLeft);
scramRight=randPermutator(rotatedRight);
scramDown=randPermutator(rotatedDown);
tempPrimaryKey1=bitxor(scramLeft,scramRight);
tempPrimaryKey2=bitxor(scramDown,scramImg);
primaryKey=bitxor(tempPrimaryKey1,tempPrimaryKey2);
[primaryKey,keylgc]=imageCutter(primaryKey);
[redKey,greenKey,blueKey]=rgbComponent(primaryKey);
[redKlr,redKud,redKrl]=flipper(redKey);
[greenKlr,greenKud,greenKrl]=flipper(greenKey);
[blueKlr,blueKud,blueKrl]=flipper(blueKey);
[redLeft,redRight,redRotate]=rotator(redKey);
[greenLeft,greenRight,greenRotate]=rotator(greenKey);
[blueLeft,blueRight,blueRotate]=rotator(blueKey);
[redRlr,redRud,redRrl]=flipper(redRotate);
[greenRlr,greenRud,greenRrl]=flipper(greenRotate);
[blueRlr,blueRud,blueRrl]=flipper(blueRotate);
[redXored]=xorer(redKlr,redKud,redKrl,redRlr,redRud,redRrl,cutrlgc);
[greenXored]=xorer(greenKlr,greenKud,greenKrl,greenRlr,greenRud,greenRrl,cutrlgc);
[blueXored]=xorer(blueKlr,blueKud,blueKrl,blueRlr,blueRud,blueRrl,cutrlgc);
tempKey=cat(3,redXored,greenXored,blueXored);
tempKey=bitxor(tempKey,OrgImg);
redTempKey=tempKey(:,:,1);
greenTempKey=tempKey(:,:,2);
blueTempKey=tempKey(:,:,3);
temp=bitxor(redTempKey,greenTempKey);
ImgKey=bitxor(temp,blueTempKey);
end