<?php
/**
 * Automatically generated by running "php schema.php mhash".
 *
 * You may modify the file, but re-runing schema.php against this file will
 * standardize the format without losing your schema changes. It does lose
 * any changes that are not part of schema. Use "note" field to comment on
 * schema itself, and "note" fields are not used in any code generation but
 * only staying within this file.
 */
///////////////////////////////////////////////////////////////////////////////
// Preamble: C++ code inserted at beginning of ext_{name}.h

DefinePreamble(<<<CPP

CPP
);

///////////////////////////////////////////////////////////////////////////////
// Constants
//
// array (
//   'name' => name of the constant
//   'type' => type of the constant
//   'note' => additional note about this constant's schema
// )


///////////////////////////////////////////////////////////////////////////////
// Functions
//
// array (
//   'name'   => name of the function
//   'desc'   => description of the function's purpose
//   'flags'  => attributes of the function, see base.php for possible values
//   'opt'    => optimization callback function's name for compiler
//   'note'   => additional note about this function's schema
//   'return' =>
//      array (
//        'type'  => return type, use Reference for ref return
//        'desc'  => description of the return value
//      )
//   'args'   => arguments
//      array (
//        'name'  => name of the argument
//        'type'  => type of the argument, use Reference for output parameter
//        'value' => default value of the argument
//        'desc'  => description of the argument
//      )
// )

DefineFunction(
  array(
    'name'   => "mhash",
    'desc'   => "mhash() applies a hash function specified by hash to the data.",
    'return' => array(
      'type'   => Variant,
      'desc'   => "Returns the resulting hash (also called digest) or HMAC as a string, or FALSE on errors. OpenSSL mhash_keygen_s2k Last updated: Fri, 06 Aug 2010  ",
    ),
    'args'   => array(
      array(
        'name'   => "hash",
        'type'   => Int64,
        'desc'   => "The hash id. One of the MHASH_XXX constants.",
      ),
      array(
        'name'   => "data",
        'type'   => String,
        'desc'   => "The user input, as a string.",
      ),
      array(
        'name'   => "key",
        'type'   => String,
        'value'  => "null_string",
        'desc'   => "If specified, the function will return the resulting HMAC instead. HMAC is keyed hashing for message authentication, or simply a message digest that depends on the specified key. Not all algorithms supported in mhash can be used in HMAC mode.",
      ),
    ),
  ));

DefineFunction(
  array(
    'name'   => "mhash_get_hash_name",
    'desc'   => "Gets the name of the specified hash.",
    'return' => array(
      'type'   => Variant,
      'desc'   => "Returns the name of the hash or FALSE, if the hash does not exist.",
    ),
    'args'   => array(
      array(
        'name'   => "hash",
        'type'   => Int64,
        'desc'   => "The hash id. One of the MHASH_XXX constants.",
      ),
    ),
  ));

DefineFunction(
  array(
    'name'   => "mhash_count",
    'desc'   => "Gets the highest available hash id.",
    'return' => array(
      'type'   => Int64,
      'desc'   => "Returns the highest available hash id. Hashes are numbered from 0 to this hash id.",
    ),
  ));

DefineFunction(
  array(
    'name'   => "mhash_get_block_size",
    'desc'   => "Gets the size of a block of the specified hash.",
    'return' => array(
      'type'   => Variant,
      'desc'   => "Returns the size in bytes or FALSE, if the hash does not exist.",
    ),
    'args'   => array(
      array(
        'name'   => "hash",
        'type'   => Int64,
        'desc'   => "The hash id. One of the MHASH_XXX constants.",
      ),
    ),
  ));

DefineFunction(
  array(
    'name'   => "mhash_keygen_s2k",
    'desc'   => "Generates a key according to the hash given a user provided password.\nThis is the Salted S2K algorithm as specified in the OpenPGP document (» RFC 2440).\nKeep in mind that user supplied passwords are not really suitable to be used as keys in cryptographic algorithms, since users normally choose keys they can write on keyboard. These passwords use only 6 to 7 bits per character (or less). It is highly recommended to use some kind of transformation (like this function) to the user supplied key.",
    'return' => array(
      'type'   => Variant,
      'desc'   => "Returns the generated key as a string, or FALSE on error.",
    ),
    'args'   => array(
      array(
        'name'   => "hash",
        'type'   => Int64,
        'desc'   => "The hash id used to create the key. One of the MHASH_XXX constants.",
      ),
      array(
        'name'   => "password",
        'type'   => String,
        'desc'   => "User supplied password.",
      ),
      array(
        'name'   => "salt",
        'type'   => String,
        'desc'   => "Must be different and random enough for every key you generate in order to create different keys. That salt must be known when you check the keys, thus it is a good idea to append the key to it. Salt has a fixed length of 8 bytes and will be padded with zeros if you supply less bytes.",
      ),
      array(
        'name'   => "bytes",
        'type'   => Int64,
        'desc'   => "The key length, in bytes.",
      ),
    ),
  ));


///////////////////////////////////////////////////////////////////////////////
// Classes
//
// BeginClass
// array (
//   'name'   => name of the class
//   'desc'   => description of the class's purpose
//   'flags'  => attributes of the class, see base.php for possible values
//   'note'   => additional note about this class's schema
//   'parent' => parent class name, if any
//   'ifaces' => array of interfaces tihs class implements
//   'bases'  => extra internal and special base classes this class requires
//   'footer' => extra C++ inserted at end of class declaration
// )
//
// DefineConstant(..)
// DefineConstant(..)
// ...
// DefineFunction(..)
// DefineFunction(..)
// ...
// DefineProperty
// DefineProperty
//
// array (
//   'name'  => name of the property
//   'type'  => type of the property
//   'flags' => attributes of the property
//   'desc'  => description of the property
//   'note'  => additional note about this property's schema
// )
//
// EndClass()

