JSJaC

## JSJaCKeys.js

#### Summary

No overview generated for 'JSJaCKeys.js'

Class Summary
JSJaCKeys | Reflects a set of sha1/md5 hash keys for securing sessions

    /**
     * Creates a new set of hash keys
     * @class Reflects a set of sha1/md5 hash keys for securing sessions
     * @constructor
     * @param {Function} func The hash function to be used for creating the keys
     * @param {Debugger} oDbg Reference to debugger implementation [optional]
     */
    function JSJaCKeys(func,oDbg) {
      var seed = Math.random();

      /**
       * @private
       */
      this._k = new Array();
      this._k[0] = seed.toString();
      if (oDbg)
        /**
         * Reference to Debugger
         * @type Debugger
         */
        this.oDbg = oDbg;
      else {
        this.oDbg = {};
        this.oDbg.log = function() {};
      }

      if (func) {
        for (var i=1; i<JSJAC_NKEYS; i++) {
          this._k[i] = func(this._k[i-1]);
          oDbg.log(i+": "+this._k[i],4);
        }
      }

      /**
       * @private
       */
      this._indexAt = JSJAC_NKEYS-1;
      /**
       * Gets next key from stack
       * @return New hash key
       * @type String
       */
      this.getKey = function() {
        return this._k[this._indexAt--];
      };
      /**
       * Indicates whether there's only one key left
       * @return <code>true</code> if there's only one key left, false otherwise
       * @type boolean
       */
      this.lastKey = function() { return (this._indexAt == 0); };
      /**
       * Returns number of overall/initial stack size
       * @return Number of keys created
       * @type int
       */
      this.size = function() { return this._k.length; };

      /**
       * @private
       */
      this._getSuspendVars = function() {
        return ('_k,_indexAt').split(',');
      }
    }

JSJaC

Documentation generated by JSDoc on Tue Jan 5 02:48:26 2021