Skip to content
Nick Ryzhy edited this page Apr 4, 2016 · 4 revisions

Encodes and decodes binary data using SHA-256 (Secure Hash Algorithm) algorithm.

Name Value
Package by.blooddy.crypto
Name final class SHA256
Inheritance SHA256SHA2ProcessEventDispatcherObject

Examples

Sync
import by.blooddy.crypto.SHA256;
var result:String = SHA256.hash( 'text' );
Async
import by.blooddy.crypto.SHA256;
import by.blooddy.crypto.events.ProcessEvent;

var sha2:SHA256= new SHA256();
sha2.hash( 'text' );
sha2.addEventListener( ProcessEvent.COMPLETE, function(event:ProcessEvent):void {
	var result:String = event.data;
	trace( result ); // async result
} );
sha2.addEventListener( ProcessEvent.ERROR, function(event:ProcessEvent):void {
	var error:Error = event.data;
	trace( error ); // async error
} );

Static Methods

Name Description
hash(str:String):String Performs hash algorithm on a String. Return a String containing the hash value of str.
hashBytes(bytes:ByteArray):String Performs hash algorithm on a ByteArray. Return a String containing the hash value of bytes.
digest(bytes:ByteArray):ByteArray Performs hash algorithm on a ByteArray. Return a ByteArray containing the hash value of bytes.

Constructor

Name Description
SHA256() Creates a SHA256 object.

Methods

Name Description
hash(str:String):void Asynchronously performs hash algorithm on a String. Dispatched String result in ProcessEvent.
hashBytes(bytes:ByteArray):void Asynchronously performs hash algorithm on a ByteArray. Dispatched String result in ProcessEvent.
digest(bytes:ByteArray):void Asynchronously performs hash algorithm on a ByteArray. Dispatched ByteArray result in ProcessEvent.

Events

Name Type Description
complete ProcessEvent Dispatched when success.
error ProcessEvent Dispatched when fault.

Hashsum

Checksum

Image

Serialization

Clone this wiki locally