mpin_hash: function()

in src/mpin256.js [133:238]


        mpin_hash: function(sha, c, U) {
            var t = [],
                w = [],
                h = [],
                H, R, i;

            c.geta().geta().geta().getA().toBytes(w);
            for (i = 0; i < this.EFS; i++) {
                t[i] = w[i];
            }
            c.geta().geta().geta().getB().toBytes(w);
            for (i = this.EFS; i < 2 * this.EFS; i++) {
                t[i] = w[i - this.EFS];
            }
            c.geta().geta().getb().getA().toBytes(w);
            for (i = 2 * this.EFS; i < 3 * this.EFS; i++) {
                t[i] = w[i - 2 * this.EFS];
            }
            c.geta().geta().getb().getB().toBytes(w);
            for (i = 3 * this.EFS; i < 4 * this.EFS; i++) {
                t[i] = w[i - 3 * this.EFS];
            }

            c.geta().getb().geta().getA().toBytes(w);
            for (i = 4 * this.EFS; i < 5 * this.EFS; i++) {
                t[i] = w[i - 4 * this.EFS];
            }
            c.geta().getb().geta().getB().toBytes(w);
            for (i = 5 * this.EFS; i < 6 * this.EFS; i++) {
                t[i] = w[i - 5 * this.EFS];
            }
            c.geta().getb().getb().getA().toBytes(w);
            for (i = 6 * this.EFS; i < 7 * this.EFS; i++) {
                t[i] = w[i - 6 * this.EFS];
            }
            c.geta().getb().getb().getB().toBytes(w);
            for (i = 7 * this.EFS; i < 8 * this.EFS; i++) {
                t[i] = w[i - 7 * this.EFS];
            }

            c.getb().geta().geta().getA().toBytes(w);
            for (i = 8 * this.EFS; i < 9 * this.EFS; i++) {
                t[i] = w[i - 8 * this.EFS];
            }
            c.getb().geta().geta().getB().toBytes(w);
            for (i = 9 *this.EFS; i < 10 * this.EFS; i++) {
                t[i] = w[i - 9 * this.EFS];
            }
            c.getb().geta().getb().getA().toBytes(w);
            for (i = 10 * this.EFS; i < 11 * this.EFS; i++) {
                t[i] = w[i - 10 * this.EFS];
            }
            c.getb().geta().getb().getB().toBytes(w);
            for (i = 11 * this.EFS; i < 12 * this.EFS; i++) {
                t[i] = w[i - 11 * this.EFS];
            }

            c.getb().getb().geta().getA().toBytes(w);
            for (i = 12 * this.EFS; i < 13 * this.EFS; i++) {
                t[i] = w[i - 12 * this.EFS];
            }
            c.getb().getb().geta().getB().toBytes(w);
            for (i = 13 * this.EFS; i < 14 * this.EFS; i++) {
                t[i] = w[i - 13 * this.EFS];
            }
            c.getb().getb().getb().getA().toBytes(w);
            for (i = 14 * this.EFS; i < 15 * this.EFS; i++) {
                t[i] = w[i - 14 * this.EFS];
            }
            c.getb().getb().getb().getB().toBytes(w);
            for (i = 15 * this.EFS; i < 16 * this.EFS; i++) {
                t[i] = w[i - 15 * this.EFS];
            }


            U.getX().toBytes(w);
            for (i = 16 * this.EFS; i < 17 * this.EFS; i++) {
                t[i] = w[i - 16 * this.EFS];
            }
            U.getY().toBytes(w);
            for (i = 17 * this.EFS; i < 18 * this.EFS; i++) {
                t[i] = w[i - 17 * this.EFS];
            }

            if (sha == this.SHA256) {
                H = new ctx.HASH256();
            } else if (sha == this.SHA384) {
                H = new ctx.HASH384();
            } else if (sha == this.SHA512) {
                H = new ctx.HASH512();
            }

            H.process_array(t);
            h = H.hash();

            if (h.length == 0) {
                return null;
            }

            R = [];
            for (i = 0; i < ctx.ECP.AESKEY; i++) {
                R[i] = h[i];
            }

            return R;
        },