[discuss] [bestbits] Fwd: ....For People who do not believe they can create Uniqueness without IANA
nathalie coupet
nathaliecoupet at yahoo.com
Fri May 30 13:53:33 UTC 2014
Hi again Willi, All,
Another question: could someone tell me what this program does?
Thanks
Nathalie
_____________________________________
<html>
<head>
<title>DHT480 Tool</title>
<script type="text/javascript">
const XOR_BASE32 = 0x13; // VRH2T 10011 for IPv4
const LOCAL_TOP_LEVEL_DOMAIN = ".® MARS";
const PLASTIC_CARD_STRING1 = "6060572447574848";
const PLASTIC_CARD_NUMBER1 = Number(PLASTIC_CARD_STRING1);
const PLASTIC_CARD_STRING2 = "1603961-10bb";
const PLASTIC_CARD_NUMBER2 = Number(PLASTIC_CARD_STRING2);
function InsertSoftWay(){
document.write("\
<font face=arial size=5>\
<center>\
<br/>\
<b><font color=blue>Z</font><font color=red>O</font><font
color=green>O</font><font color=blue>M</font></b>://Soft.WAY.®\
<br/>\
<font size=-2><span
onclick='Dedication(\".MARS\");'>Copyright 1981-2014
The.UNIR.Project.™</span></font>\
</center>\
</font>\
");
document.write("<center><font face=arial
size=3><b>"+PLASTIC_CARD_STRING1+"</b> "+Date()+"
<b>"+PLASTIC_CARD_STRING2+"</b></font></center>");
}
//
// Dedication
//
function Dedication(planet){
alert("C at T is Alive on "+planet+"\nNZ N=14 Z=26\n01110
11010\nDedicated to an Angel, D & JD\nVisit "+planet+"\n
TC.2014");
}
var LargeInteger = 4000000000000000000 + Number(new Date()); // Spice
things up a bit
var Multiplier=1;
var CurrentPI = LargeInteger;
var CurrentI = 1;
var CurrentSign = 1;
var SpigotCount=0;
var DHTlimit = 15; // 256*15=3840 3840/480=8 3840/256=15
var LastSaved = -1;
var MatrixCard = "1234567890123456";
/////////////////////////////(C).Soft.WAY.(R) Sun Feb 23 2014 03:43:11
GMT-0600 (Central Standard Time)
//
// class TimeByte
//
// Generate CamelCase String for 8-bit TimeByte - could be "" for 0x00
//
// DYMWDSHM - Decade.Year.Month.Week.Day.SHIFT.Hour.Minute
// DYMWDSHM - Decade.Year.Month.Week.Day.SHIFT.Hour.Moment
//
function ZOOM_TimeByte_toString(aTimeByte){
var _ = "";
if(aTimeByte & 0x80){
_ += "Decade";
}
if(aTimeByte & 0x40){
_ += "Year";
}
if(aTimeByte & 0x20){
_ += "Month";
}
if(aTimeByte & 0x10){
_ += "Week";
}
if(aTimeByte & 0x08){
_ += "Day";
}
if(aTimeByte & 0x04){
_ += "Shift";
}
if(aTimeByte & 0x02){
_ += "Hour";
}
if(aTimeByte & 0x01){
_ += "Moment";
}
return _;
}
/////////////////////////////(C).Soft.WAY.(R) Sun Feb 23 2014 03:43:11
GMT-0600 (Central Standard Time)
//
// class Date
//
// Date.add_aTimeByte(aByte);
//
// DYMWDSHM - Decade.Year.Month.Week.Day.SHIFT.Hour.Minute
// DYMWDSHM - Decade.Year.Month.Week.Day.SHIFT.Hour.Moment
//
// 10011011 - Decade..Week.Day..Hour.Moment
// 00011011 - ...Week.Day..Hour.Moment
//
// SHIFT - Random value from 8 to 12 hours - Discrete Random Shifts ~
8 9 10 11 12 hours
// MOMENT - Random value from 60 to 480 Seconds depending on .NET Load
when the PUT() is done
//
function ZOOM_Date_add_aTimeByte(aDate,aTimeByte){
// typeOf aDate and aTimeByte should be checked - just in case -
C at T just checks number of arguments
var _ = new Date(aDate.getTime()); // make a separate new object to return
if(aTimeByte & 0x01){
var randomMoment = (Math.random()*420)+60; // Random value
from 60 to 480 Seconds
_.setUTCSeconds(_.getUTCSeconds()+randomMoment);
}
if(aTimeByte & 0x02){
_.setUTCHours(_.getUTCHours()+1);
}
if(aTimeByte & 0x04){
var randomShift = Math.floor(Math.random()*5)+8; // Discrete
Random Shifts ~ 8 9 10 11 12 hours
_.setUTCHours(_.getUTCHours()+randomShift);
}
if(aTimeByte & 0x08){
_.setUTCHours(_.getUTCHours()+24);
}
if(aTimeByte & 0x10){
_.setUTCHours(_.getUTCHours()+168);
}
if(aTimeByte & 0x20){
_.setUTCMonth(_.getUTCMonth()+1);
}
if(aTimeByte & 0x40){
_.setUTCFullYear(_.getUTCFullYear()+1);
}
if(aTimeByte & 0x80){
_.setUTCFullYear(_.getUTCFullYear()+10);
}
// Returns a Date Object NOT a DateTime48
return _;
}
//////////////////////////////////////////////////////////////////////////////
// Binary class methods
var Binary = {
// Convert a string to a byte array
stringToBytes: function (str) {
for (var bytes = [], i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i));
return bytes;
},
// Convert a byte array to a string
bytesToString: function (bytes) {
for (var str = [], i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join("");
},
// Convert a HEX string to a byte array
hexToBytes: function (str) {
for (var bytes = [], i = 0; i < str.length; i+=2){
bytes.push(((str.charCodeAt(i)-48)<<4)+(str.charCodeAt(i+1)-48));
}
return bytes;
}
}
function Base32String_fromString (s) {
return ZOOM_Base32Array_fromString(s).join("");
}
function ZOOM_Base32String_fromBytes(bytes){
var _ = "";
_ = ZOOM_String_fromBytes(bytes);
return ZOOM_Base32_fromString(_);
}
function ZOOM_Base32Array_fromString (s) {
var base32bits = 5; // 2^5=32 log2(32)=5
var alphabet = "0ABCDEFGHIJKLMNOPQRSTUVWXYZ12389"; // 32 Symbols
// pad with 0 to be multiple of 40 bits
while( ((s.length*8) % 40) != 0){
s += '\x00';
}
var n40bit = (s.length*8)/40;
var parts = [];
// process 40-bits at a time
for (i = 0; i < n40bit; i++) {
parts.push(alphabet.charAt(s.charCodeAt(i*5) >> 3));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5) & 0x07) << 2)
| (s.charCodeAt(i*5+1) >> 6)));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5+1) & 0x3F) >> 1) ));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5+1) & 0x01) << 4)
| (s.charCodeAt(i*5+2) >> 4)));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5+2) & 0x0F) << 1)
| (s.charCodeAt(i*5+3) >> 7)));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5+3) & 0x7F) >> 2)));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5+3) & 0x03) << 3)
| (s.charCodeAt(i*5+4) >> 5)));
parts.push(alphabet.charAt( ((s.charCodeAt(i*5+4) & 0x1F) )));
}
return parts;
}
//
// class Date48
//
// Loc3+Century5+Year7+Month4+Date5+Hour5+Min6+Sec6+Msec7=48
// lllCCCCC.YYYYYYYM.MMMDDDDD.HHHHHMMM.MMMSSSSS.Smmmmmmm
//
// a 6-byte class commonly used in a 160-bit MatrixWord160
//
// MatrixWord160 Fixed160 = [class16+key32+locDateTime48+random32]~checksum32
//
// return the 48-bit ZOOM.Date used in 160-bit DHT480
//
//
function ZOOM_Date48_asBytes(location){
//C at T today=Date.new();
var today = new Date();
var msec = Math.floor((today.getUTCMilliseconds()/1000)*127)&0x7F;
var _ = [];
if(typeof location == "undefined"){
location = 0;
}
_.push(location & 0x07); // [0] Loc3 0-7 EARTH=0 MARS=7
_.push(Math.floor(today.getUTCFullYear()/100)); // [1] CCCCC 0-31
_.push(today.getUTCFullYear()%100); // [2] YYYYYYY7 0-99
_.push(today.getUTCMonth()); // [3] MMMM4 0-11 Jan-Dec
_.push(today.getUTCDate()); // [4] DDDDD5 1-31
_.push(today.getUTCHours()); // [5] HHHHH5 1-23
_.push(today.getUTCMinutes()); // [6] MMMMMM6 1-60
_.push(today.getUTCSeconds()); // [7] SSSSSS6 1-60
_.push(msec); // [8] mmmmmmm7 0-127 mapped & rounded (above)
return _;
}
function ZOOM_Date48_asBits(aDate48){
var _ = "";
for(var i=0; i<6; i++){
_ = _ + ZOOM_Byte_toBitString(aDate48[i]);
}
return _;
}
// Loc3+Century5+Year7+Month4+Date5+Hour5+Min6+Sec6+msec5=48
// lllCCCCC.YYYYYYYM.MMMDDDDD.HHHHHMMM.MMMSSSSS.Smmmmmmm
function ZOOM_Date48(){
var today = ZOOM_Date48_asBytes(0); // [0] Loc3 0-7 EARTH=0 MARS=7
return ZOOM_Date48_encodeFromBytes(today);
}
function ZOOM_Date48_encodeFromBytes(bytes){
var _ = [];
_.push(((bytes[0]<<5)&0xE0)|((bytes[1]>>0)&0x1F)); // [0] lllCCCCC
_.push(((bytes[2]<<1)&0xFE)|((bytes[3]>>3)&0x01)); // [1] YYYYYYYM
_.push(((bytes[3]<<5)&0xE0)|((bytes[4]>>0)&0x1F)); // [2] MMMDDDDD
_.push(((bytes[5]<<3)&0xF8)|((bytes[6]>>3)&0x07)); // [3] HHHHHMMM
_.push(((bytes[6]<<5)&0xE0)|((bytes[7]>>1)&0x1F)); // [4] MMMSSSSS
_.push(((bytes[7]<<7)&0x80)|((bytes[8]>>0)&0x7F)); // [5] Smmmmmmm
return _;
}
//
// class Class160
//
// ZOOM 160 bit Header - Version16 + Key32 + DateTime48 + Random32
+ Checksum32
function ZOOM_Bytes_160(class16Bytes,key32Bytes){
var pi32 = 3141592653;
var random32 = Math.floor(Math.random()*pi32); // PI based 3.14159...
//TEST var random32 = Math.floor(.99999999999999*pi32); // PI
based 3.14159...
var _ = [];
//_.push((class16>>8)&0xFF); _.push(class16&0xFF);
_.push(class16Bytes[0]); _.push(class16Bytes[1]);
//_.push((key32>>24)&0xFF); _.push((key32>>16)&0xFF);
_.push((key32>>8)&0xFF); _.push((key32)&0xFF);
_.push(key32Bytes[0]); _.push(key32Bytes[1]);
_.push(key32Bytes[2]); _.push(key32Bytes[3]);
//48
// BUG found in Bytes to Hex - a single push shows in alert but is
missing in for loop
var zoomDate = ZOOM_Date48();
for(var i=0; i<6; i++){
_.push(zoomDate[i]);
}
//96
_.push((random32>>24)&0xFF); _.push((random32>>16)&0xFF);
_.push((random32>>8)&0xFF); _.push((random32)&0xFF);
//128
var checksum = Crypto.SHA256(Crypto.SHA256(_, { asBytes: true }),
{ asBytes: true });
_.push(checksum[0]); _.push(checksum[1]); _.push(checksum[2]);
_.push(checksum[3]);
//160
return _;
}
// pack single bytes into string one per uni-code 16-bit doubleByte
function ZOOM_String_fromBytes(bytes){
var _String = "";
for(var i = 0; i < bytes.length; i++) {
_String += String.fromCharCode(bytes[i]);
}
return _String;
}
// Pull 40 bits from 8 Symbols and store in 5 bytes
//
// Example
//NZDZ M8NA
//
// 0 1 2 3 4 5 6 7
//
//01110 11010 00100 11010 01101 11110 01110 00001
//
//01110 110|10 00100 1|1010 0110|1 11110 01|110 00001
function ZOOM_Bytes5_fromString8(input){
var alphabet = "0ABCDEFGHIJKLMNOPQRSTUVWXYZ12389"; // Base32 Symbols
var _value = 0;
var parts = [];
parts.push(((alphabet.indexOf(input[0])&0x1F)<<3)|((alphabet.indexOf(input[1])&0x1C)>>2));
parts.push(((alphabet.indexOf(input[1])&0x03)<<6)|((alphabet.indexOf(input[2])&0x1F)<<1)|((alphabet.indexOf(input[3])&0x10)>>4));
parts.push(((alphabet.indexOf(input[3])&0x0F)<<4)|((alphabet.indexOf(input[4])&0x1E)>>1));
parts.push(((alphabet.indexOf(input[4])&0x01)<<7)|((alphabet.indexOf(input[5])&0x1F)<<2)|((alphabet.indexOf(input[6])&0x18)>>3));
parts.push(((alphabet.indexOf(input[6])&0x07)<<5)|(alphabet.indexOf(input[7])&0x1F));
return parts;
}
// Extract bytes from Base32 String of 200-bit Account
// Type8 + Hash160 + Checksum32
// Example: "NZDZM8NAYHSL9NQF1X0ZD8SGGX3AS9CCTVBILHHH"
// returns 118,137,166,249,193,202,38,207,186,38,222,1,162,122,103,62,58,25,252,99,165,132,150,33,8
//
function ZOOM_Bytes_fromBase32Account(input){
var parts = [];
for(var i = 0; i<5; i++){
parts.push(ZOOM_Bytes5_fromString8(input.substr(i*8,8)));
}
return parts;
}
// ZOOM_PrintableBase32_fromString
//
// Encode a string using custom Base32 (5-bits per Symbol)
// Operates on 40 bits at a time (40=5*8)
// Pads with 0x00 to ensure 40-bit boundaries
// 200-bit eWallet - 25 bytes - 40 Symbols Base32
// 160-bit IPv3 Header - 20 bytes - 32 Symbols Base32
//
// Steal 2+3=5 bits from 160-bit hash - 10+155+35 - Type10+Hash155+CheckSum35
// makes it appear as if Type10 is two symbols and Checksum is 35 bits
// Type10 is really only 8 bits and CheckSum35 is really 32 bits
function ZOOM_PrintableBase32_fromString (s) {
var parts = ZOOM_Base32Array_fromString(s);
return ZOOM_PrintableBase32_fromArray(parts);
}
function ZOOM_PrintableBase32_fromArray (parts) {
return "<b><font size=+2>"+parts[0]+parts[1]+"</font>.</b>"+
parts[2]+parts[3]+parts[4]+parts[5]+parts[6]+parts[7]+parts[8]+parts[9]+
parts[10]+parts[11]+parts[12]+parts[13]+parts[14]+parts[15]+parts[16]+parts[17]+
parts[18]+parts[19]+parts[20]+parts[21]+parts[22]+parts[23]+parts[24]+parts[25]+
parts[26]+parts[27]+parts[28]+parts[29]+parts[30]+parts[31]+parts[32]+
"<b>."+parts[33]+parts[34]+parts[35]+parts[36]+parts[37]+parts[38]+parts[39]+"</b>";
}
function ZOOM_Base32_fromString (s) {
var parts = ZOOM_Base32Array_fromString(s);
return parts.join("");
}
// Just the base32 symbols - works for various sizes
function ZOOM_BasicPrintableBase32_fromString (s) {
var parts = ZOOM_Base32Array_fromString(s);
return parts.join("");
}
// DNSD BASE64 [0-9,A-Z,a-z,-.]
//
// Note [-.] do not show up when only digits are used in the original key
function Base64String_fromString (s) {
return ZOOM_Base64Array_fromString(s).join("");
}
function ZOOM_Base64Array_fromString (s) {
var base64bits = 6; // 2^6=64 log2(64)=6
var alphabet =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-."; //
64 Symbols
// pad with 0 to be multiple of 24 bits
while( ((s.length*8) % 24) != 0){
s += '\x00';
}
var n24bit = (s.length*8)/24;
var parts = [];
// process 24-bits at a time
for (var i = 0; i < n24bit; i++) {
parts.push(alphabet.charAt(s.charCodeAt(i*3) >> 2)); //6
parts.push(alphabet.charAt( ((s.charCodeAt(i*3) & 0x03) << 4) //2
| ((s.charCodeAt(i*3+1) & 0xF0) >> 4))); //4
parts.push(alphabet.charAt( ((s.charCodeAt(i*3+1) & 0x0F) << 2) //4
| ((s.charCodeAt(i*3+2) & 0xC0) >> 6))); //2
parts.push(alphabet.charAt( (s.charCodeAt(i*3+2) & 0x3F)));
}
return parts;
}
function ZOOM_MD160(messageBytes){
return Crypto.RIPEMD160(messageBytes, { asBytes: true });
}
function ZOOM_SHA256(messageBytes){
return Crypto.SHA256(messageBytes, { asBytes: true });
}
///////////////////////////////////// END ZOOM
///////////////////////////////////////
</script>
<script type="text/javascript">
////////////////////////////////// CRYPTO
//////////////////////////////////////////
/*!
* Crypto-JS v2.0.0
* http://code.google.com/p/crypto-js/
* Copyright (c) 2009, Jeff Mott. All rights reserved.
* http://code.google.com/p/crypto-js/wiki/License
*/
(function () {
// map is likely unused because builtin browser functions are used
// [A-Z,a-z,0-9,+/] "=" used for padding
var base64map =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
//var base64map =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.";
// Global Crypto object
var Crypto = window.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {
return (n << b) | (n >>> (32 - b));
},
// Bit-wise rotate right
rotr: function (n, b) {
return (n << (32 - b)) | (n >>> b);
},
// Swap big-endian to little-endian and vice versa
endian: function (n) {
// If number given, swap endian
if(n.constructor == Number) {
return util.rotl(n, 8) & 0x00FF00FF | util.rotl(n, 24) & 0xFF00FF00;
}
// Else, assume array and swap all items
for(var i = 0; i < n.length; i++)
n[i] = util.endian(n[i]);
return n;
},
// Generate an array of any length of random bytes
randomBytes: function (n) {
for (var bytes = []; n > 0; n--)
bytes.push(Math.floor(Math.random() * 256));
return bytes;
},
// Convert a byte array to big-endian 32-bit words
bytesToWords: function (bytes) {
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
words[b >>> 5] |= bytes[i] << (24 - b % 32);
return words;
},
// Convert big-endian 32-bit words to a byte array
wordsToBytes: function (words) {
for(var bytes = [], b = 0; b < words.length * 32; b += 8)
bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
return bytes;
},
// Convert a byte array to a hex string
bytesToHex: function (bytes) {
//BUG bytes with single push do not have proper length
(missing interior values)
for(var hex = [], i = 0; i < bytes.length; i++) {
hex.push((bytes[i] >>> 4).toString(16));
hex.push((bytes[i] & 0xF).toString(16));
}
return hex.join("");
},
// Convert a hex string to a byte array
hexToBytes: function (hex) {
for(var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
},
// Convert a byte array to a base-64 string - "=" as pad
bytesToBase64: function (bytes) {
// Use browser-native function if it exists
if(typeof btoa == "function"){
//alert("Using builtin btoa for base64");
return btoa(Binary.bytesToString(bytes));
}
// likely not used - see above
for(var base64 = [], i = 0; i < bytes.length; i += 3) {
var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
for(var j = 0; j < 4; j++){
if(i * 8 + j * 6 <= bytes.length * 8)
base64.push(base64map.charAt((triplet >>> 6 * (3 -
j)) & 0x3F));
else base64.push("=");
}
}
return base64.join("");
},
// Convert a base-64 string to a byte array
base64ToBytes: function (base64) {
// Use browser-native function if it exists
if (typeof atob == "function") {
//alert("using builtin atob");
return Binary.stringToBytes(atob(base64));
}
// below likely not used - see above
// Remove non-base-64 characters
//BUG???? what about a-z ?
//base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
//Assume input has proper characters
for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
imod4 = ++i % 4) {
if (imod4 == 0) continue;
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) &
(Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) |
(base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
}
return bytes;
}
};
/////////////////////////////////////////////////////////////
// Crypto mode namespace
Crypto.mode = {};
// Crypto character encodings
var charenc = Crypto.charenc = {};
//////////////////////// UTF-8 ///////////////////////////////
// UTF-8 encoding
var UTF8 = charenc.UTF8 = {
// Convert a string to a byte array
stringToBytes: function (str) {
return Binary.stringToBytes(unescape(encodeURIComponent(str)));
},
// Convert a byte array to a string
bytesToString: function (bytes) {
return decodeURIComponent(escape(Binary.bytesToString(bytes)));
}
};
//////////////////////// Binary ///////////////////////////////
// Binary encoding
var Binary = charenc.Binary = {
// Convert a string to a byte array
stringToBytes: function (str) {
for (var bytes = [], i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i));
return bytes;
},
// Convert a byte array to a string
bytesToString: function (bytes) {
for (var str = [], i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join("");
}
};
})();
////////////////////////////////// SHA256
//////////////////////////////////////////
/*!
* Crypto-JS v2.0.0
* http://code.google.com/p/crypto-js/
* Copyright (c) 2009, Jeff Mott. All rights reserved.
* http://code.google.com/p/crypto-js/wiki/License
*/
(function () {
// Shortcuts
var C = Crypto,
util = C.util,
charenc = C.charenc,
UTF8 = charenc.UTF8,
Binary = charenc.Binary;
// Constants
var K = [0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2];
// Public API
var SHA256 = C.SHA256 = function (message, options) {
var digestbytes = util.wordsToBytes(SHA256._sha256(message));
return options && options.asBytes ? digestbytes :
options && options.asString ? Binary.bytesToString(digestbytes) :
util.bytesToHex(digestbytes);
};
// The core
SHA256._sha256 = function (message) {
// Convert to byte array
if (message.constructor == String) message =
UTF8.stringToBytes(message);
/* else, assume byte array already */
var m = util.bytesToWords(message),
l = message.length * 8,
H = [0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19],
w = [],
a, b, c, d, e, f, g, h, i, j,
t1, t2;
// Padding
m[l >> 5] |= 0x80 << (24 - l % 32);
m[((l + 64 >> 9) << 4) + 15] = l;
for (var i = 0; i < m.length; i += 16) {
a = H[0];
b = H[1];
c = H[2];
d = H[3];
e = H[4];
f = H[5];
g = H[6];
h = H[7];
for (var j = 0; j < 64; j++) {
if (j < 16) w[j] = m[j + i];
else {
var gamma0x = w[j - 15],
gamma1x = w[j - 2],
gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
((gamma0x << 14) | (gamma0x >>> 18)) ^
(gamma0x >>> 3),
gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
((gamma1x << 13) | (gamma1x >>> 19)) ^
(gamma1x >>> 10);
w[j] = gamma0 + (w[j - 7] >>> 0) +
gamma1 + (w[j - 16] >>> 0);
}
var ch = e & f ^ ~e & g,
maj = a & b ^ a & c ^ b & c,
sigma0 = ((a << 30) | (a >>> 2)) ^
((a << 19) | (a >>> 13)) ^
((a << 10) | (a >>> 22)),
sigma1 = ((e << 26) | (e >>> 6)) ^
((e << 21) | (e >>> 11)) ^
((e << 7) | (e >>> 25));
t1 = (h >>> 0) + sigma1 + ch + (K[j]) + (w[j] >>> 0);
t2 = sigma0 + maj;
h = g;
g = f;
f = e;
e = d + t1;
d = c;
c = b;
b = a;
a = t1 + t2;
}
H[0] += a;
H[1] += b;
H[2] += c;
H[3] += d;
H[4] += e;
H[5] += f;
H[6] += g;
H[7] += h;
}
return H;
};
// Package private blocksize
SHA256._blocksize = 16;
})();
////////////////// RIPEMD-160 ////////////////////////////////////////
/*!
* Crypto-JS v2.0.0
* http://code.google.com/p/crypto-js/
* Copyright (c) 2009, Jeff Mott. All rights reserved.
* http://code.google.com/p/crypto-js/wiki/License
*
* A JavaScript implementation of the RIPEMD-160 Algorithm
* Version 2.2 Copyright Jeremy Lin, Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
* Also http://www.ocf.berkeley.edu/~jjlin/jsotp/
* Ported to Crypto-JS by Stefan Thomas.
*/
(function () {
// Shortcuts
var C = Crypto,
util = C.util,
charenc = C.charenc,
UTF8 = charenc.UTF8,
Binary = charenc.Binary;
// Convert a byte array to little-endian 32-bit words
util.bytesToLWords = function (bytes) {
var output = Array(bytes.length >> 2);
for (var i = 0; i < output.length; i++)
output[i] = 0;
for (var i = 0; i < bytes.length * 8; i += 8)
output[i >> 5] |= (bytes[i / 8] & 0xFF) << (i % 32);
return output;
};
// Convert little-endian 32-bit words to a byte array
util.lWordsToBytes = function (words) {
var output = [];
for (var i = 0; i < words.length * 32; i += 8)
output.push((words[i >> 5] >>> (i % 32)) & 0xff);
return output;
};
// Public API
var RIPEMD160 = C.RIPEMD160 = function (message, options) {
var digestbytes =
util.lWordsToBytes(RIPEMD160._rmd160(message));
return options && options.asBytes ? digestbytes :
options && options.asString ? Binary.bytesToString(digestbytes) :
util.bytesToHex(digestbytes);
};
// The core
RIPEMD160._rmd160 = function (message) {
// Convert to byte array
if (message.constructor == String) message =
UTF8.stringToBytes(message);
var x = util.bytesToLWords(message),
len = message.length * 8;
/* append padding */
x[len >> 5] |= 0x80 << (len % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var h0 = 0x67452301;
var h1 = 0xefcdab89;
var h2 = 0x98badcfe;
var h3 = 0x10325476;
var h4 = 0xc3d2e1f0;
for (var i = 0; i < x.length; i += 16) {
var T;
var A1 = h0, B1 = h1, C1 = h2, D1 = h3, E1 = h4;
var A2 = h0, B2 = h1, C2 = h2, D2 = h3, E2 = h4;
for (var j = 0; j <= 79; ++j) {
T = safe_add(A1, rmd160_f(j, B1, C1, D1));
T = safe_add(T, x[i + rmd160_r1[j]]);
T = safe_add(T, rmd160_K1(j));
T = safe_add(bit_rol(T, rmd160_s1[j]), E1);
A1 = E1; E1 = D1; D1 = bit_rol(C1, 10); C1 = B1; B1 = T;
T = safe_add(A2, rmd160_f(79 - j, B2, C2, D2));
T = safe_add(T, x[i + rmd160_r2[j]]);
T = safe_add(T, rmd160_K2(j));
T = safe_add(bit_rol(T, rmd160_s2[j]), E2);
A2 = E2; E2 = D2; D2 = bit_rol(C2, 10); C2 = B2; B2 = T;
}
T = safe_add(h1, safe_add(C1, D2));
h1 = safe_add(h2, safe_add(D1, E2));
h2 = safe_add(h3, safe_add(E1, A2));
h3 = safe_add(h4, safe_add(A1, B2));
h4 = safe_add(h0, safe_add(B1, C2));
h0 = T;
}
return [h0, h1, h2, h3, h4];
}
function rmd160_f(j, x, y, z) {
return (0 <= j && j <= 15) ? (x ^ y ^ z) :
(16 <= j && j <= 31) ? (x & y) | (~x & z) :
(32 <= j && j <= 47) ? (x | ~y) ^ z :
(48 <= j && j <= 63) ? (x & z) | (y & ~z) :
(64 <= j && j <= 79) ? x ^ (y | ~z) :
"rmd160_f: j out of range";
}
function rmd160_K1(j) {
return (0 <= j && j <= 15) ? 0x00000000 :
(16 <= j && j <= 31) ? 0x5a827999 :
(32 <= j && j <= 47) ? 0x6ed9eba1 :
(48 <= j && j <= 63) ? 0x8f1bbcdc :
(64 <= j && j <= 79) ? 0xa953fd4e :
"rmd160_K1: j out of range";
}
function rmd160_K2(j) {
return (0 <= j && j <= 15) ? 0x50a28be6 :
(16 <= j && j <= 31) ? 0x5c4dd124 :
(32 <= j && j <= 47) ? 0x6d703ef3 :
(48 <= j && j <= 63) ? 0x7a6d76e9 :
(64 <= j && j <= 79) ? 0x00000000 :
"rmd160_K2: j out of range";
}
var rmd160_r1 = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
];
var rmd160_r2 = [
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
];
var rmd160_s1 = [
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
];
var rmd160_s2 = [
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
];
/*
* Add integers, wrapping at 2^32. This uses 16-bit
operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bit_rol(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
})();
///////////////////////////END RIPEMD160/////////////////////////////////////
function ImportCard1(matrix){
if(typeof matrix != 'string'){
alert("MatrixCard #1 is not a string");
return;
}
if(matrix.length > 16){
alert("Spaces removed");
matrix = matrix.replace(/[ \n\r]/g,''); // for some reason
spaces (32) get inserted
}
if(!(/^[0123456789]{16}$/.test(matrix))){
alert("Entry is not MATRIX Card format");
return;
}
MatrixCard1 = matrix;
LargeInteger = 4000000000000000000 + Number(new Date()) + Number(matrix);
document.getElementById("LargeInteger").innerHTML = LargeInteger;
}
function ImportCard2(matrix){
if(typeof matrix != 'string'){
alert("MatrixCard #2 is not a string");
return;
}
if(matrix.length > 16){
alert("Spaces removed");
matrix = matrix.replace(/[ \n\r]/g,''); // for some reason
spaces (32) get inserted
}
if(!(/^[0123456789]{16}$/.test(matrix))){
alert("Entry is not MATRIX Card format");
return;
}
MatrixCard2 = matrix;
LargeInteger = 4000000000000000000 + Number(new Date()) + Number(matrix);
document.getElementById("LargeInteger").innerHTML = LargeInteger;
}
function ImportMatrix(matrix){
//DHT480_EXPIRE_aKey(DHT480_TEST_KEY);
if(typeof matrix != 'string'){
alert("Matrix is not a string");
return;
}
if(matrix.length > 960){
//alert("Spaces removed");
matrix = matrix.replace(/[ \n\r]/g,''); // for some reason
spaces (32) get inserted
}
if(!(/^[123456789\n]{960}$/.test(matrix))){
alert("Entry is not DHT480 MATRIX format");
return;
}
var bytes = Binary.stringToBytes(matrix);
var index=0;
for(var i=0; i<8; i++){
var key = [];
for(var j=0; j<120; j++){
key.push(bytes[index++]-48); // ASCII "0" (48) not used
but the offset is there
}
document.getElementById("SPIGOT").innerHTML =
document.getElementById("SPIGOT").innerHTML+key.join("")+"\n";
}
}
function ComputePI(event){
if(!LargeInteger){
alert("LargeInteger is not set yet...");
return;
}
var iterations = (event.clientX+event.clientY)*Multiplier;
for(var i=1; i<iterations; i+=2){
ComputePIonce();
}
}
function ComputePIonce(){
//document.getElementById("LargeInteger").innerHTML = LargeInteger;
CurrentI += 2;
document.getElementById("CurrentI").innerHTML = CurrentI;
document.getElementById("LargeCurrent").innerHTML = LargeInteger/CurrentI;
if(CurrentSign == 0){
CurrentPI += LargeInteger/CurrentI;
CurrentSign = 1;
}
else{
CurrentPI -= LargeInteger/CurrentI;
CurrentSign = 0;
}
document.getElementById("CurrentPI").innerHTML = CurrentPI;
if(CurrentI <10){
CapturePI(); // Clipboard has Limit
}
/*
* Add your captures here
*
if(CurrentI == 12345){
CapturePI();
}
if(CurrentI == 9999){
CapturePI();
}
if(CurrentI <128){
CapturePI();
}
if((CurrentI%10000) == 9999){
CapturePI();
}
*
*/
}
function CapturePI(){
// replace all the 0s with [1 to 9] because 0 is Disabled in the
IPv3 PIDEX Protocol
// random replacement values are NOT used because we want the
process to be repeatable (deterministic)
// Don't allow PI Indexes with any 0 digits - this can confuse the
user who clicks expecting a capture
//if(String(CurrentI).indexOf("0") != -1){
// return;
//}
if(SpigotCount >= DHTlimit){
return;
}
if(LastSaved == CurrentI){
alert("Click Slower OR Move Mouse to Upper Left");
return;
}
LastSaved = CurrentI;
var noZeroes = ReplaceRandom(String(CurrentPI));
var dateTime = Number(new Date());
//var dateTime = "112233445566778899";
document.getElementById("SPIGOT").innerHTML =
document.getElementById("SPIGOT").innerHTML+LargeInteger+MatrixCard1+MatrixCard2+CurrentI+CurrentPI+","+noZeroes+dateTime+","+(Math.floor(Math.random()
* 1000000000000))+"00000<br>";
SpigotCount++;
}
function ReplaceRandom(aString){
var _ = aString;
//var start=0;
const start = Math.floor(Math.random() * 10); // Start random but
use in sequence - not as random as all random replacement
for(var i=start; (_.indexOf('0') != -1); i++){
_ = _.replace(/0/,(i%9)+1); // Don't replace 0 with 0 - use 1
to 9 over and over
}
return _;
}
function ClearSpigot(){
document.getElementById("CLIPBOARD").innerHTML =
document.getElementById("SPIGOT").innerHTML;
document.getElementById("SPIGOT").innerHTML = "";
SpigotCount=0;
}
function InitPI(){
LargeInteger = 4000000000000000000 + Number(new Date()); // Spice
things up a bit
//LargeInteger = 4000000000000000000; // 0x3782DACE9D900000
document.getElementById("LargeInteger").innerHTML = LargeInteger;
Multiplier=1;
CurrentPI = LargeInteger;
CurrentI = 1;
CurrentSign = 1;
SpigotCount=0;
DHTlimit = 15; // 256*15=3840 3840/480=8 3840/256=15
LastSaved = -1;
MatrixCard1 = "6060572447574848";
MatrixCard2 = "6060572447574848";
}
function Accelerate(){
if(Multiplier > 4){
alert("You may need a faster computer...");
Multiplier = .5;
return;
}
Multiplier=Multiplier*2;
}
function MakeKeys(){
// Get rid of commas and zeroes
var clipboard =
ReplaceRandom((document.getElementById("CLIPBOARD").innerHTML).replace(/,/g,""));
// no commas or zeroes at this point
// where do these come from?
clipboard = clipboard.replace(/<font>/g,"");
clipboard = clipboard.replace(/<\/font>/g,"");
// UNIX was built on the single byte newline vs CR-LF etc
clipboard = clipboard.replace(/<br>/g,"\n");
var keys = "";
var endofline;
// Zeroes will be gone at this point
if(!/[123456789\n]/.test(clipboard)){
alert("CLIPBOARD has bad format - Did you CAPTURE anything?");
return;
}
while((endofline=clipboard.indexOf('\n')) != -1){
keys += clipboard.substr(0,120) + '\n';
var common =
Binary.bytesToString(Binary.hexToBytes(clipboard.substr(0,120)));
keys += Base32String_fromString(common) + '\n';
//DHT480_PUT_aKeyDataTime(Base32String_fromString(common),random_TestArray(),random_TimeByte());
DHT480_PUT_aKeyDataTime(Base32String_fromString(common),random_TestArray(),1);
keys += Base64String_fromString(common) + '\n\n';
clipboard = clipboard.replace(/^.*\n/,"");
}
document.getElementById("KEYS").innerHTML = "<pre>"+keys+"</pre>";
}
function OneSecond(){
setTimeout(function () { OneSecond(); }, 1000);
ComputePIonce();
DHT480_EXPIRE_ALL();
//CapturePI();
}
function RESET(){
InitPI();
ClearSpigot();
}
</script>
</head>
<!--
CSS STYLE
-->
<style type="text/css">
.details { background-color: #DDDDDD; font-family: Arial; font-size:
100%; clear: both; width: 400px; padding: 10px 0 10px 0; margin: 50px
auto auto auto; }
.footer { background-color: #DDDDDD; font-family: Arial; font-size:
50%; clear: both; width: 696px; padding: 10px 0 10px 0; margin: 50px
auto auto auto; }
</style>
<!--
BODY
-->
<body onclick="CapturePI();" onkeypress="" onmousemove="ComputePI(event);">
<!--
VIEW
-->
<span><input type="button" value="RESET" onclick="RESET();" /></span>
<center>
<font face=arial>
<div id="tagline">
<font size=5><b>Techno.C at T's</b></font>
<br/>
<b>Stand-Alone</b> [OFFLINE] <i>JavaScript</i> DNSD eWALLET DHT480 PI Workbench
<br>
<h4>Did you know that PI = 2.222222222222222... ? [Hint: Not BASE10]</h4>
</div>
<br/>
<div id="commands">
<br/>
<span><b>Enter MATRIX Card #1:</b><input type="text" id="MatrixCard1"
size=16 maxLength=16 value="1234567890123456"
onfocus="this.select();" onkeypress="if (event.keyCode == 13)
ImportCard1(document.getElementById('MatrixCard1').value);"> [0-9
ONLY]
<br/>
<span>
<input type="button" id="cardimport" value="Enter Plastic Card #1"
onclick="ImportCard1(document.getElementById('MatrixCard1').value);"
/>
<b><font size=2>...NUMERIC ONLY entry...16 Digits...</font></b>
</span>
<br/>
<br/>
<span><b>Enter MATRIX Card #2:</b><input type="text" id="MatrixCard2"
size=16 maxLength=16 value="1234567890123456"
onfocus="this.select();" onkeypress="if (event.keyCode == 13)
ImportCard1(document.getElementById('MatrixCard2').value);"> [0-9
ONLY]
<br/>
<span>
<input type="button" id="cardimport" value="Enter Plastic Card #2"
onclick="ImportCard2(document.getElementById('MatrixCard2').value);"
/>
<b><font size=2>...NUMERIC ONLY entry...16 Digits...</font></b>
</span>
<br/>
</div>
<br/>
<h3>...Move Mouse near RESET to Iterate FASTER...Click CLEAR and
CAPTURE of SPIGOT...</h3>
<div class="details">LargeInteger:<div id="LargeInteger">[]</div>
CurrentI:<div id="CurrentI">[]</div> LargeInteger/CurrentI:<div
id="LargeCurrent">[]</div></div>
<br>
<i>Are WE There YET ?</i>....4/1-4/3+4/5-4/7+4/9-4/11+...
<span><input type="button" value="ACCELERATE" onclick="Accelerate();" /></span>
<h3>31415926535897932384626433832795</h3>
<font face=arial size=12><div id="CurrentPI">[]</div></font>
<br>
Copy and Paste from DHT480 MATRIX...
<br/>
<span><b>Enter MATRIX:</b><input type="text" id="dhtMatrix" size=64
maxLength=974 value="PASTE MATRIX HERE"
onfocus="this.select();" onkeypress="if (event.keyCode == 13)
ImportMatrix(document.getElementById('dhtMatrix').value);"> [1-9 ONLY]
<br/>
<span>
<input type="button" id="dnsdimport" value="IMPORT"
onclick="ImportMatrix(document.getElementById('dhtMatrix').value);" />
<b><font size=2>...NUMERIC ONLY entry...SPACES will be removed...</font></b>
</span>
<br/>
<script type="text/javascript"> InsertSoftWay(); </script>
<h1>ZOOM://Soft.WAY.™</h1>
<span><input type="button" value="CLEAR and CAPTURE to CLIPBOARD"
onclick="ClearSpigot();" /></span>
<br/>
<b>SPIGOT</b><div id="SPIGOT"></div>
<br/>
<b>CLIPBOARD (CSV)</b><div id="CLIPBOARD" onclick=""></div>
<br/>
<span><input type="button" value="reMAKE KEYS from CLIPBOARD"
onclick="MakeKeys();" /></span>
<br/>
<b>480-bit DHT KEYS<br>1to9HEX (120 Symbols) - Base32 (96 Symbols)
Base64 (80 Symbols ~ KeyPunchCard)</b><div id="KEYS" onclick=""></div>
</div>
<!--
SAMPLE MATRIX
-->
<pre>
SAMPLE MATRIX - CUT AND PASTE to IMPORT above...
819412345139691696237891434567139891696239123139491696236656789123326666675939446415456726666675939446415678913919169623
672345678593466667872128134234563466667872128134234781399916962614123456778289523919199713923456289523916199773989178139
991696261412345679833396837919878132345633396837919878132347813999169626151234567294598314152585732732891234314152585732
732834556139791697399489533689631416531178387256912331416531118327256344513969169746927843659153141539689238917789123141
539389238917456341395916975552673398694314164395966778739123314164395966778739145139691697617378443171531415474196747467
789131415474196747417232313949169768625624482133141638366974456678913141638366974126345231394916977364562448213314163836
697445667891314163836697423645623139491697784256246463331415547519213614678931415597119213614231213939169783284514646323
141553741921361456783141552731921361445911392916978827349464651314163678825281332345314163678825281339167139891697941691
</pre>
<i>...THIS is NOT an RFC...C at T</i>
<br/>
<pre><div id="TESTAREA"></div></pre>
<script type="text/javascript">
var isArray = Function.isArray || function(o) {
return typeof o === "object" &&
Object.prototype.toString.call(o) === "[object Array]";
};
const Date_Today = new Date();
const Date_Time = Date_Today.getTime();
document.write(Date_Today);
document.write(Date_Time+" :: ");
document.write(
((Date_Time>>56)&0xFF)+'.'+((Date_Time>>48)&0xFF)+'.'+((Date_Time>>40)&0xFF)+'.'+((Date_Time>>32)&0xFF)+'.'+((Date_Time>>24)&0xFF)+'.'+((Date_Time>>16)&0xFF)+'.'+((Date_Time>>8)&0xFF)+'.'+((Date_Time>>0)&0xFF));
//////////////////////////////////////////////////////////////////////////////
//
// DHT480 has TWO methods PUT(KEY480,DATA8192,TIME8) and GET(KEY480)
//
// Create a test Array with KEY480,DATA8192 the TIME8 {TimeByte} is
not tested here...see below
// BASE32 96*5=480 ~ One Symbol short appended below
const testKEY =
"0ABCDEFGHIJKLMNOPQRSTUVWXYZ123890ABCDEFGHIJKLMNOPQRSTUVWXYZ123890ABCDEFGHIJKLMNOPQRSTUVWXYZ1238";
// Leave the 9 off
// in BASE32 the 0 Symbol is 00000 0x00 therefore 96 0 Symbols is
96*5=480 bits of ALL 0s 00000...00000
const DHT480_ZERO_KEY =
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
const DHT480_ONES_KEY =
"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999";
const DHT480_TEST_KEY =
"HDQTJD2UN3IFF8DQDM0RFQKGQEHRFQKFOBHRFHSTOEBSBPJXIEKXHPXXL8AQHELDRU2DHLLDJZHRBNJWPX1QBYQRDRHWMAXV";
// in BASE32 the 9 Symbol is 11111 0x1F therefore 96 9 Symbols is
96*5=480 bits of ALL 1s 11111...11111
// 96 Symbol RULERs
// "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
// "0ABCDEFGHIJKLMNOPQRSTUVWXYZ123890ABCDEFGHIJKLMNOPQRSTUVWXYZ123890ABCDEFGHIJKLMNOPQRSTUVWXYZ12389"
// "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
// "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
//
// 96 digits from a PI_SPIGOT - NOT #BASE32 note the digits other than {012389}
// "819412345139691696237891434567139891696239123139491696236656789123326666675939446415456726666675"
//
//
// "000P00HB0LJAXWIQICAQP1J9ER88BLA8S3GMIJ8NZTDSZNVOU0QR33DQFZWCNH0FJ1B8P23QHDGWKB8JMZQCCFPSBA1CV98U"
//
const DHT480_base32_alphabet = "0ABCDEFGHIJKLMNOPQRSTUVWXYZ12389";
var DHT480_table = new Array(32); // 32 rows of the test key table
//
// STORE an entry in the DHT480
//
// aKey - aString of 96 #BASE32 Symbols (96x5=480)
// anArray - 1024 Bytes of Data
// aTimeByte - DYMWDSHM - Decade.Year.Month.Week.Day.SHIFT.Hour.Moment
function DHT480_PUT_aKeyDataTime(aKey,anArray,aTimeByte){
if(aKey in DHT480_table){
alert(aKey+" exists");
return DHT480_ZERO_KEY;
}
if(aKey.length != 96){
return DHT480_ONES_KEY;
}
if(anArray.length != 1024){
return DHT480_ONES_KEY;
}
for(var i=0; i<1024; i++){
if( ! ((anArray[i] >= 0) && (anArray[i] <= 255)) ){
return DHT480_ONES_KEY;
}
}
if( ! ((aTimeByte >= 0) && (aTimeByte <= 255)) ){
return DHT480_ONES_KEY;
}
DHT480_table[aKey] = new Array(1025);
DHT480_table[aKey][0] = (ZOOM_Date_add_aTimeByte((new
Date()),aTimeByte)).getTime();
for(var i=1; i<=1024; i++){
DHT480_table[aKey][i] = anArray[i-1];
}
return aKey;
}
//
// GET an entry from the DHT480
//
function DHT480_GET_aKey(aKey){
if(aKey.length != 96){
return undefined;
}
var _ = new Array(1024);
for(var i=1; i<=1024; i++){
_[i-1] = DHT480_table[aKey][i];
}
return _;
}
//
// EXPIRE an entry from the DHT480
//
function DHT480_EXPIRE_aKey(aKey){
//if(DHT480_table[aKey] == undefined){
//alert(aKey+" does not exist");
// return;
//}
if(!(aKey in DHT480_table)){
return aKey;
}
if(aKey.length != 96){
return aKey;
}
var now = new Date().getTime();
if(DHT480_table[aKey][0] < now){
console.log("Expired:"+aKey+":"+new Date);
delete DHT480_table[aKey];
}
else{
//alert(aKey+" expires at "+DHT480_table[aKey][0]+":::"+new
Date(DHT480_table[aKey][0]));
}
return aKey;
}
function DHT480_EXPIRE_ALL(){
var p;
for(p in DHT480_table){ // Loop through the properties
//console.log(p);
DHT480_EXPIRE_aKey(p);
}
}
// Fill the ZERO_KEY DATA8192 with 0s 00000...00000
DHT480_table[DHT480_ZERO_KEY] = new Array(1025);
for(var col = 1; col <= 1024; col++) {
DHT480_table[DHT480_ZERO_KEY][col] = 0;
}
DHT480_table[DHT480_ZERO_KEY][0] = (new Date()).getTime();
// Fill the ONES_KEY DATA8192 with 1s 11111...11111
DHT480_table[DHT480_ONES_KEY] = new Array(1025);
for(var col = 1; col <= 1024; col++) {
DHT480_table[DHT480_ONES_KEY][col] = 255; // 0xFF
}
DHT480_table[DHT480_ONES_KEY][0] = (new Date()).getTime();
// Dump the properties to a TESTAREA
function dumpDHT480(){
document.getElementById("TESTAREA").innerHTML = "";
for(p in DHT480_table){ // Loop through the properties
//console.log(p);
document.getElementById("TESTAREA").innerHTML += p + '<br/>';
var limit = 0;
for(q in DHT480_table[p]){
document.getElementById("TESTAREA").innerHTML += q + ":" +
DHT480_table[p][q] + ",";
if(limit++ > 10) break;
}
document.getElementById("TESTAREA").innerHTML += '<br/>';
}
}
function random_TestArray(){
var _ = [];
for(var i = 0; i<1024; i++){
_[i] = Math.floor(Math.random() * 256);
}
return _;
}
function random_TestROM(){
var _ = new Array(522240);
for(var i = 0; i<522240; i++){
_[i] = Math.floor(Math.random() * 256);
}
return _;
}
function random_TimeByte(){
return Math.floor(Math.random() * 256);
}
//DHT480_PUT_aKeyDataTime(DHT480_TEST_KEY,random_TestArray(),random_TimeByte());
//DHT480_PUT_aKeyDataTime(DHT480_TEST_KEY,random_TestArray(),random_TimeByte());
DHT480_PUT_aKeyDataTime(DHT480_TEST_KEY,random_TestArray(),1); // the
smallest TimeByte = aMoment up to 8 minutes
//alert(DHT480_TEST_KEY);
DHT480_EXPIRE_aKey(DHT480_TEST_KEY);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
</script>
<!--
FOOTER
-->
<div class="footer" onclick="Dedication('MARS 128n 128e');">
<center><span>Copyright © 1981-2014 The UNIR™
Project</span></center><br>
<span>Comments & JavaScript Copyrights are included in the Source</span>
<br/>
<span>No Warranty - FREEly pass this around the IPv3 IPv16 ZOOM #COMNET</span>
<br/>
<span>THIS IS NOT an RFC or Property of <b>THE.XXX.ORGy</b> aka
The.Big.Lie.Society*</span>
<br/>
...
<br/>
<span>#COMNET only uses .COM and .NET Legacy DNS ~ .NET derives from
.COM ~ #NETCOM</span>
<br/>
</div>
</font>
</center>
<!--
CONTROLLER
-->
<script type="text/javascript">
//
// GlobalROM BLOBsize is 522240 Bytes
//
// 272 x 480 x 32bits - based on SONY PSP Screen Size
//
var GlobalROM = random_TestROM();
var GlobalROM_BTC160 = ZOOM_MD160(ZOOM_SHA256(GlobalROM));
var GlobalROM_MD160 = ZOOM_MD160(GlobalROM);
// DHT480 Handle for GlobalROM
// Class160 zoomBytes160
// BTC160 GlobalROM_BTC160
// RIPE160
// Class160
var version16=[];
version16.push(255);version16.push(255);
//_.push((key32>>24)&0xFF); _.push((key32>>16)&0xFF);
_.push((key32>>8)&0xFF); _.push((key32)&0xFF);
var key32=[255,255,255,255];
var zoomBytes160 = ZOOM_Bytes_160(version16,key32); // Class160
// Key480
var zoomGlobalROM_key480 = [];
// Assemble the three objects Class160 BTC160 MD160
zoomGlobalROM_key480 =
zoomGlobalROM_key480.concat(zoomBytes160,GlobalROM_BTC160,GlobalROM_MD160);
var ZOOMstring96 = ZOOM_Base32String_fromBytes(zoomGlobalROM_key480);
// Time = DYMWDSHM - Decade.Year.Month.Week.Day.SHIFT.Hour.Moment
DHT480_PUT_aKeyDataTime(ZOOMstring96,random_TestArray(),3);
RESET();
setInterval("dumpDHT480()",10000);
CapturePI();
OneSecond();
for(var i=0; i<100000; i++){
for(p in DHT480_table){ // Loop through the properties
//console.log(p);
DHT480_EXPIRE_aKey(p);
}
}
</script>
<script type="text/javascript"> InsertSoftWay(); </script>
</body>
</html>
--
____________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://1net-mail.1net.org/pipermail/discuss/attachments/20140530/0d5bc1df/attachment-0001.html>
More information about the discuss
mailing list