MD5, SHA1 and SHA-256 Encryption Utility

Saturday, October 6th, 2007

If you work with different types of encrypted data it is often quite useful to have a utility available from which you can utilize to encrypt a String to a specific encryption format.

I find it particularly useful to isolate each available encryption object into a single Helper / Utility class to help facilitate encryption requests; essentially providing a wrapper for all encryption objects.

The Encryption utility is an all static class which is intended to provide a solution for centralizing access to encryption classes. The Encryption utility simply wraps all encryption types available in a Flex Application and provides a single static method for encrypting a String to the specified encryption type.

Additionally, the Encryption utility provides constants which represent each supported encryption type; SHA-256, SHA1 and MD5.

Using the Encryption utility is simple and straightforward as one might expect. The following examples demonstrate a typical use-case in which a String; “test”, is encrypted utilizing each defined encryption type:

So if you need an easy to use, centralized location from which you can conveniently call up to encrypt a String, feel free to utilize the Encryption utility.

The Encryption utility is protected under the MIT license.

{ Comments are closed! }