Cryptico

How to COMPUTE a key

A public key can be obtained elsewhere, so no need to worry about encryption or signature verification.

A private key could be obtained elsewhere too, but such a feature is not available in my implementation.

Put a passphrase into the My Passphrase field.

Press the Compute button.

Get the computed key from the My Key field.

How to ENCRYPT a message

Put the public key of the receiver into the Their Public Key field.

Put your decrypted message into the Input Message field.

If you want to add your signature to the encrypted message, put your key into the My Key field, otherwise leave it blank.

Press the Encrypt button.

Get the encrypted message from the Output Message field.

How to DECRYPT a message

If the encrypted message carries a signature you want to match, put the public key of the sender into the Their Public Key field.

Put your encrypted message into the Input Message field.

Put your key into the My Key field.

Press the Decrypt button.

Get the decrypted message from the Output Message field.

Their Public Key

My Key or Passphrase

My Public Key (computed)

Input Message

Output Message

Their Public Key (computed)

//
// Math.seedrandom(‘yipee’); Sets Math.random to a function that is
// initialized using the given explicit seed.
//
// Math.seedrandom(); Sets Math.random to a function that is
// seeded using the current time, dom state,
// and other accumulated local entropy.
// The generated seed string is returned.
//
// Math.seedrandom(‘yowza’, true);
// Seeds using the given explicit seed mixed
// together with accumulated entropy.
//
//
// Seeds using physical random bits downloaded
// from random.org.
//
// Seeds using urandom bits from call.jsonlib.com,
// which is faster than random.org.
//
// Examples:
//
// Math.seedrandom(“hello”); // Use “hello” as the seed.
// document.write(Math.random()); // Always 0.5463663768140734
// document.write(Math.random()); // Always 0.43973793770592234
// var rng1 = Math.random; // Remember the current prng.
//
// var autoseed = Math.seedrandom(); // New prng with an automatic seed.
// document.write(Math.random()); // Pretty much unpredictable.
//
// Math.random = rng1; // Continue “hello” prng sequence.
// document.write(Math.random()); // Always 0.554769432473455
//
// Math.seedrandom(autoseed); // Restart at the previous seed.
// document.write(Math.random()); // Repeat the ‘unpredictable’ value.
//
// Notes:
//
// Each time seedrandom(‘arg’) is called, entropy from the passed seed
// is accumulated in a pool to help generate future seeds for the
// zero-argument form of Math.seedrandom, so entropy can be injected over
// time by calling seedrandom with explicit data repeatedly.
//
// On speed – This javascript implementation of Math.random() is about
// 3-10x slower than the built-in Math.random() because it is not native
// code, but this is typically fast enough anyway. Seeding is more expensive,
// especially if you use auto-seeding. Some details (timings on Chrome 4):
//
// Our Math.random() – avg less than 0.002 milliseconds per call
// seedrandom(‘explicit’) – avg less than 0.5 milliseconds per call
// seedrandom(‘explicit’, true) – avg less than 2 milliseconds per call
// seedrandom() – avg about 38 milliseconds per call
//
// LICENSE (BSD):
//
// Copyright 2010 David Bau, all rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of this module nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
/**
* All code is in an anonymous closure to keep the global namespace clean.
*
* @param {number=} overflow
* @param {number=} startdenom
*/
(function (pool, math, width, chunks, significance, overflow, startdenom)
{