Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

@@ -0,0 +1,61 @@
package com.hurlant.crypto.symmetric
{
import com.hurlant.util.Memory;
import flash.utils.ByteArray;
public class SimpleIVMode implements IMode, ICipher
{
protected var mode:IVMode;
protected var cipher:ICipher;
public function SimpleIVMode(mode:IVMode)
{
super();
this.mode = mode;
this.cipher = mode as ICipher;
}
public function getBlockSize() : uint
{
return this.mode.getBlockSize();
}
public function dispose() : void
{
this.mode.dispose();
this.mode = null;
this.cipher = null;
Memory.gc();
}
public function encrypt(src:ByteArray) : void
{
this.cipher.encrypt(src);
var tmp:ByteArray = new ByteArray();
tmp.writeBytes(this.mode.IV);
tmp.writeBytes(src);
src.position = 0;
src.writeBytes(tmp);
}
public function decrypt(src:ByteArray) : void
{
var tmp:ByteArray = new ByteArray();
tmp.writeBytes(src,0,this.getBlockSize());
this.mode.IV = tmp;
tmp = new ByteArray();
tmp.writeBytes(src,this.getBlockSize());
this.cipher.decrypt(tmp);
src.length = 0;
src.writeBytes(tmp);
}
public function toString() : String
{
return "simple-" + this.cipher.toString();
}
}
}