Package openlink.util

## Class MD5

- java.lang.Object
- - openlink.util.MD5

    public class MD5
    extends java.lang.Object

Implementation of RSA's MD5 hash generator

### Constructor Summary

Constructors
`MD5​()` Class constructor
`MD5​(java.lang.Object ob)` Initialize class, and update hash with ob.toString()

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`java.lang.String` `asHex​()` Returns 32-character hex representation of this objects hash
`static java.lang.String` `asHex​(byte[] hash)` Turns array of bytes into string representing each byte as unsigned hex number.
`byte[]` `Final​()` Returns array of bytes (16 bytes) representing hash as of the current state of this object.
`void` `Init​()` Initialize MD5 internal state (object can be reused just by calling Init() after every Final()
`static java.lang.String` `md5_digest​(java.lang.String user, java.lang.String password, java.lang.String ses_name)`
`static java.lang.String` `pwd_magic_encrypt​(java.lang.String user_name, java.lang.String password)`
`void` `Update​(byte b)` Updates hash with a single byte
`void` `Update​(byte[] buffer)` Updates hash with given array of bytes
`void` `Update​(byte[] buffer, int length)` Plain update, updates this object
`void` `Update​(byte[] buffer, int offset, int length)` Plain update, updates this object
`void` `Update​(int i)` Update buffer with a single integer (only & 0xff part is used, as a byte)
`void` `Update​(java.lang.String s)` Update buffer with given string.
`void` `Update​(openlink.util.MD5State stat, byte[] buffer, int offset, int length)` Updates hash with the bytebuffer given (using at maximum length bytes from that buffer)

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MD5

    public MD5​()

Class constructor

#### MD5

    public MD5​(java.lang.Object ob)

Initialize class, and update hash with ob.toString()

Parameters:
  `ob` - Object, ob.toString() is used to update hash after initialization

### Method Detail

#### Init

    public void Init​()

Initialize MD5 internal state (object can be reused just by calling Init() after every Final()

#### Update

    public void Update​(openlink.util.MD5State stat,
                       byte[] buffer,
                       int offset,
                       int length)

Updates hash with the bytebuffer given (using at maximum length bytes from that buffer)

Parameters:
  `stat` - Which state is updated
  `buffer` - Array of bytes to be hashed
  `offset` - Offset to buffer array
  `length` - Use at maximum `length' bytes (absolute maximum is buffer.length)

#### Update

    public void Update​(byte[] buffer,
                       int offset,
                       int length)

Plain update, updates this object

Parameters:
  `buffer` - Array of bytes
  `offset` - offset of data in array
  `length` - length of data

#### Update

    public void Update​(byte[] buffer,
                       int length)

Plain update, updates this object

Parameters:
  `buffer` - Array of bytes
  `length` - length of data

#### Update

    public void Update​(byte[] buffer)

Updates hash with given array of bytes

Parameters:
  `buffer` - Array of bytes to use for updating the hash

#### Update

    public void Update​(byte b)

Updates hash with a single byte

Parameters:
  `b` - Single byte to update the hash

#### Update

    public void Update​(java.lang.String s)

Update buffer with given string.

Parameters:
  `s` - String to be update to hash (is used as s.getBytes())

#### Update

    public void Update​(int i)

Update buffer with a single integer (only & 0xff part is used, as a byte)

Parameters:
  `i` - Integer value, which is then converted to byte as i & 0xff

#### Final

    public byte[] Final​()

Returns array of bytes (16 bytes) representing hash as of the current state of this object. Note: getting a hash does not invalidate the hash object, it only creates a copy of the real state which is finalized.

Returns:
  Array of 16 bytes, the hash of all updated bytes

#### asHex

    public static java.lang.String asHex​(byte[] hash)

Turns array of bytes into string representing each byte as unsigned hex number.

Parameters:
  `hash` - Array of bytes to convert to hex-string
Returns:
  Generated hex string

#### asHex

    public java.lang.String asHex​()

Returns 32-character hex representation of this objects hash

Returns:
  String of this object's hash

#### md5_digest

    public static java.lang.String md5_digest​(java.lang.String user,
                                              java.lang.String password,
                                              java.lang.String ses_name)

#### pwd_magic_encrypt

    public static java.lang.String pwd_magic_encrypt​(java.lang.String user_name,
                                                     java.lang.String password)