mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 17:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,63 @@
|
||||
package com.hurlant.crypto.hash
|
||||
{
|
||||
import flash.utils.ByteArray;
|
||||
import flash.utils.Endian;
|
||||
|
||||
public class SHABase implements IHash
|
||||
{
|
||||
|
||||
public function SHABase()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function getInputSize() : uint
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
public function getHashSize() : uint
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function hash(src:ByteArray) : ByteArray
|
||||
{
|
||||
var savedLength:uint = src.length;
|
||||
var savedEndian:String = src.endian;
|
||||
src.endian = Endian.BIG_ENDIAN;
|
||||
var len:uint = savedLength * 8;
|
||||
while(src.length % 4 != 0)
|
||||
{
|
||||
src[src.length] = 0;
|
||||
}
|
||||
src.position = 0;
|
||||
var a:Array = [];
|
||||
for(var i:uint = 0; i < src.length; i += 4)
|
||||
{
|
||||
a.push(src.readUnsignedInt());
|
||||
}
|
||||
var h:Array = this.core(a,len);
|
||||
var out:ByteArray = new ByteArray();
|
||||
var words:uint = this.getHashSize() / 4;
|
||||
for(i = 0; i < words; i++)
|
||||
{
|
||||
out.writeUnsignedInt(h[i]);
|
||||
}
|
||||
src.length = savedLength;
|
||||
src.endian = savedEndian;
|
||||
return out;
|
||||
}
|
||||
|
||||
protected function core(x:Array, len:uint) : Array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "sha";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user