Skip to content
Snippets Groups Projects
Commit a676d712 authored by Ben Adida's avatar Ben Adida
Browse files

re-added helios django app as part of the same git project

parent 1a650466
No related branches found
No related tags found
No related merge requests found
Showing
with 1902 additions and 0 deletions
helios/media/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png

251 B

helios/media/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png

178 B

helios/media/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png

104 B

helios/media/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png

125 B

helios/media/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png

105 B

helios/media/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png

3.67 KiB

helios/media/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png

90 B

helios/media/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png

129 B

helios/media/css/ui-lightness/images/ui-icons_222222_256x240.png

4.27 KiB

helios/media/css/ui-lightness/images/ui-icons_228ef1_256x240.png

5.23 KiB

helios/media/css/ui-lightness/images/ui-icons_ef8c08_256x240.png

4.27 KiB

helios/media/css/ui-lightness/images/ui-icons_ffd27a_256x240.png

4.27 KiB

helios/media/css/ui-lightness/images/ui-icons_ffffff_256x240.png

4.27 KiB

This diff is collapsed.
File added
/*
* A simple applet for generating Bigints from JavaScript
*
* inspired from Stanford's SRP, and extended for Prime Number generation.
*/
public class bigint extends java.applet.Applet {
public java.security.SecureRandom newSecureRandom() {
return new java.security.SecureRandom();
}
public java.math.BigInteger newBigInteger(String value, int radix) {
return new java.math.BigInteger(value, radix);
}
public java.math.BigInteger randomBigInteger(int bitlen, java.util.Random rng) {
return new java.math.BigInteger(bitlen, rng);
}
public java.math.BigInteger randomPrimeBigInteger(int bitlen, int certainty, java.util.Random rng) {
return new java.math.BigInteger(bitlen, certainty, rng);
}
}
/*
* This software incorporates components derived from the
* Secure Remote Password JavaScript demo developed by
* Tom Wu (tjw@CS.Stanford.EDU).
*
* This library is almost entirely re-written by Ben Adida (ben@adida.net)
* with a BigInt wrapper.
*/
// A wrapper for java.math.BigInteger with some appropriate extra functions for JSON and
// generally being a nice JavaScript object.
BigInt = Class.extend({
init: function(value, radix) {
if (value == null) {
throw "null value!";
}
if (BigInt.use_applet) {
this._java_bigint = BigInt.APPLET.newBigInteger(value, radix);
} else {
try {
this._java_bigint = new java.math.BigInteger(value, radix);
} catch (e) {
// alert("oy " + e.toString() + " value=" + value + " , radix=" + radix);
throw TypeError
}
}
},
toString: function() {
return this._java_bigint.toString() + "";
},
toJSONObject: function() {
// toString is apparently not overridden in IE, so we reproduce it here.
return this._java_bigint.toString() + "";
},
add: function(other) {
return BigInt._from_java_object(this._java_bigint.add(other._java_bigint));
},
bitLength: function() {
return this._java_bigint.bitLength();
},
mod: function(modulus) {
return BigInt._from_java_object(this._java_bigint.mod(modulus._java_bigint));
},
equals: function(other) {
return this._java_bigint.equals(other._java_bigint);
},
modPow: function(exp, modulus) {
return BigInt._from_java_object(this._java_bigint.modPow(exp._java_bigint, modulus._java_bigint));
},
negate: function() {
return BigInt._from_java_object(this._java_bigint.negate());
},
multiply: function(other) {
return BigInt._from_java_object(this._java_bigint.multiply(other._java_bigint));
},
modInverse: function(modulus) {
return BigInt._from_java_object(this._java_bigint.modInverse(modulus._java_bigint));
}
});
BigInt.ready_p = false;
//
// Some Class Methods
//
BigInt._from_java_object = function(jo) {
// bogus object
var obj = new BigInt("0",10);
obj._java_bigint = jo;
return obj;
};
BigInt.fromJSONObject = function(s) {
return new BigInt(s, 10);
};
BigInt.fromInt = function(i) {
return BigInt.fromJSONObject("" + i);
};
//
// do the applet check
//
function check_applet() {
/* Is this Netscape 4.xx? */
var is_ns4 = (navigator.appName == "Netscape" && navigator.appVersion < "5");
/* Do we need the toString() workaround (requires applet)? */
var str_workaround = (navigator.appName == "Opera");
// stuff this in BigInt
BigInt.is_ie = (navigator.appName == "Microsoft Internet Explorer");
/* Decide whether we need the helper applet or not */
var use_applet = BigInt.is_ie || (!is_ns4 && navigator.platform.substr(0, 5) == "Linux") || str_workaround || typeof(java) == 'undefined';
// add the applet
if (use_applet) {
var applet_base = '/static/helios/helios/';
var applet_html = '<applet codebase="' + applet_base + '" mayscript name="bigint" code="bigint.class" width=1 height=1 id="bigint_applet"></applet>';
// var applet_html = '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" name="bigint" width="1" height="1" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"> <param name="code" value="bigint.class"> <param name="codebase" value="' + applet_base + '"> <param name="archive" value="myapplet.jar"> <param name="type" value="application/x-java-applet;version=1.5.0"> <param name="scriptable" value="true"> <param name="mayscript" value="false"> <comment> <embed code="bigint.class" name="bigint" java_codebase="' + applet_base + '" width="1" height="1" scriptable="true" mayscript="false" type="application/x-java-applet;version=1.5.0" pluginspage="http://java.sun.com/j2se/1.5.0/download.html"> <noembed>No Java Support.</noembed> </embed> </comment> </object>';
$("#applet_div").html(applet_html);
}
return use_applet;
};
// Set up the pointer to the applet if necessary, and some
// basic Big Ints that everyone needs (0, 1, 2, and 42)
BigInt._setup = function() {
if (BigInt.use_applet) {
BigInt.APPLET = document.applets["bigint"];
}
try {
BigInt.ZERO = new BigInt("0",10);
BigInt.ONE = new BigInt("1",10);
BigInt.TWO = new BigInt("2",10);
BigInt.FORTY_TWO = new BigInt("42",10);
BigInt.ready_p = true;
} catch (e) {
// not ready
// count how many times we've tried
if (this.num_invocations == null)
this.num_invocations = 0;
this.num_invocations += 1;
if (this.num_invocations > 5) {
if (BigInt.setup_interval)
window.clearInterval(BigInt.setup_interval);
if (BigInt.setup_fail) {
BigInt.setup_fail();
} else {
alert('bigint failed!');
}
}
return;
}
if (BigInt.setup_interval)
window.clearInterval(BigInt.setup_interval);
if (BigInt.setup_callback)
BigInt.setup_callback();
};
BigInt.setup = function(callback, fail_callback) {
if (callback)
BigInt.setup_callback = callback;
if (fail_callback)
BigInt.setup_fail = fail_callback;
BigInt.setup_interval = window.setInterval("BigInt._setup()", 1000);
}
// .onload instead of .ready, as I don't think the applet is ready until onload.
// FIXME: something wrong here in the first load
$(document).ready(function() {
BigInt.use_applet = check_applet();
});
/*
* John Resig's Class Inheritance
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};
// Create a new Class that inherits from this class
Class.extend = function(prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
initializing = false;
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function(name, fn){
return function() {
var tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
// The dummy class constructor
function Class() {
// All construction is actually done in the init method
if ( !initializing && this.init )
this.init.apply(this, arguments);
}
// Populate our constructed prototype object
Class.prototype = prototype;
// Enforce the constructor to be what we expect
Class.constructor = Class;
// And make this class extendable
Class.extend = arguments.callee;
return Class;
};
})();
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment