com.caucho.quercus.lib
Class HashModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.HashModule
All Implemented Interfaces:
QuercusModule

public class HashModule
extends AbstractQuercusModule

Hash functions. This module uses the MessageDigest class to calculate digests. Typical java installations support MD2, MD5, SHA1, SHA256, SHA384, and SHA512.


Nested Class Summary
static class HashModule.HashContext
           
static class HashModule.HashDigestContext
           
static class HashModule.HashMacContext
           
 
Field Summary
static int HASH_HMAC
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
HashModule()
           
 
Method Summary
 java.lang.String[] getLoadedExtensions()
          Returns the extensions loaded by the module.
static Value hash_algos(Env env)
          Returns the list of known algorithms
 HashModule.HashContext hash_copy(HashModule.HashContext context)
          Copies a hash instance
 Value hash_file(Env env, java.lang.String algorithm, Path path, boolean isBinary)
          Hashes a file
 Value hash_final(Env env, HashModule.HashContext context, boolean isBinary)
          Returns the final hash value
 Value hash_hmac_file(Env env, java.lang.String algorithm, Path path, StringValue key, boolean isBinary)
          Hashes a file with the algorithm.
 Value hash_hmac(Env env, java.lang.String algorithm, StringValue data, StringValue key, boolean isBinary)
          Hashes a string with the algorithm.
 HashModule.HashContext hash_init(Env env, java.lang.String algorithm, int options, StringValue keyString)
          Initialize a hash context.
 Value hash_update_file(Env env, HashModule.HashContext context, Path path)
          Updates the hash with more data
 int hash_update_stream(Env env, HashModule.HashContext context, java.io.InputStream is, int length)
          Updates the hash with more data
 Value hash_update(Env env, HashModule.HashContext context, StringValue value)
          Updates the hash with more data
 Value hash(Env env, java.lang.String algorithm, StringValue string, boolean isBinary)
          Hashes a string
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HASH_HMAC

public static final int HASH_HMAC
See Also:
Constant Field Values
Constructor Detail

HashModule

public HashModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Description copied from class: AbstractQuercusModule
Returns the extensions loaded by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

hash

public Value hash(Env env,
                  java.lang.String algorithm,
                  StringValue string,
                  boolean isBinary)
Hashes a string


hash_algos

public static Value hash_algos(Env env)
Returns the list of known algorithms


hash_copy

public HashModule.HashContext hash_copy(HashModule.HashContext context)
Copies a hash instance


hash_file

public Value hash_file(Env env,
                       java.lang.String algorithm,
                       Path path,
                       boolean isBinary)
Hashes a file


hash_final

public Value hash_final(Env env,
                        HashModule.HashContext context,
                        boolean isBinary)
Returns the final hash value


hash_hmac

public Value hash_hmac(Env env,
                       java.lang.String algorithm,
                       StringValue data,
                       StringValue key,
                       boolean isBinary)
Hashes a string with the algorithm.


hash_hmac_file

public Value hash_hmac_file(Env env,
                            java.lang.String algorithm,
                            Path path,
                            StringValue key,
                            boolean isBinary)
Hashes a file with the algorithm.


hash_init

public HashModule.HashContext hash_init(Env env,
                                        java.lang.String algorithm,
                                        int options,
                                        StringValue keyString)
Initialize a hash context.


hash_update

public Value hash_update(Env env,
                         HashModule.HashContext context,
                         StringValue value)
Updates the hash with more data


hash_update_file

public Value hash_update_file(Env env,
                              HashModule.HashContext context,
                              Path path)
Updates the hash with more data


hash_update_stream

public int hash_update_stream(Env env,
                              HashModule.HashContext context,
                              java.io.InputStream is,
                              int length)
Updates the hash with more data