Browse Source

merged with master

gh-pages
Igor Zhukov 11 years ago
parent
commit
69dfc9dfda
  1. 3
      app.manifest
  2. 8
      css/app.css
  3. 33
      js/app.js
  4. 2
      js/app.js.map
  5. 2
      js/background.js
  6. 2
      js/lib/aes_worker.js
  7. 96
      js/lib/bin_utils.js
  8. 3
      js/lib/pq_worker.js
  9. 2
      js/lib/sha1_worker.js
  10. 2
      manifest.json
  11. 2
      manifest.webapp
  12. 1507
      vendor/leemon_bigint/bigint.js
  13. 3
      webogram.appcache

3
app.manifest

@ -1,5 +1,5 @@
CACHE MANIFEST
# Time: Fri Jun 27 2014 19:23:26 GMT+0400 (MSK)
# Time: Wed Jul 02 2014 20:55:06 GMT+0400 (MSK)
CACHE:
@ -70,6 +70,7 @@ vendor/closure/long.js
vendor/console-polyfill/console-polyfill.js
vendor/cryptoJS/crypto.js
vendor/jsbn/jsbn_combined.js
vendor/leemon_bigint/bigint.js
NETWORK:

8
css/app.css

File diff suppressed because one or more lines are too long

33
js/app.js

File diff suppressed because one or more lines are too long

2
js/app.js.map

File diff suppressed because one or more lines are too long

2
js/background.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.1.8 - messaging web application for MTProto
* Webogram v0.1.9 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
js/lib/aes_worker.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.1.8 - messaging web application for MTProto
* Webogram v0.1.9 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

96
js/lib/bin_utils.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.1.8 - messaging web application for MTProto
* Webogram v0.1.9 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -144,6 +144,12 @@ function bytesFromBigInt (bigInt, len) {
return bytes;
}
function bytesFromLeemonBigInt (bigInt, len) {
var str = bigInt2str(bigInt, 16);
return bytesFromHex(str);
}
function bytesToArrayBuffer (b) {
return (new Uint8Array(b)).buffer;
}
@ -277,7 +283,14 @@ function pqPrimeFactorization (pqBytes) {
console.log('PQ start', pqBytes, what.bitLength());
if (what.bitLength() <= 64) {
try {
result = pqPrimeLeemon(str2bigInt(what.toString(16), 16, Math.ceil(64 / bpe) + 1))
} catch (e) {
console.error(e);
console.error('Pq leemon Exception', e);
}
if (result === false && what.bitLength() <= 64) {
// console.time('PQ long');
try {
result = pqPrimeLong(goog.math.Long.fromString(what.toString(16), 16));
@ -374,7 +387,6 @@ function gcdLong(a, b) {
}
function pqPrimeLong(what) {
// console.log('start long');
var it = 0,
g;
for (var i = 0; i < 3; i++) {
@ -385,9 +397,6 @@ function pqPrimeLong(what) {
for (var j = 1; j < lim; j++) {
++it;
// if (!(it % 100)) {
// console.log(dT(), 'it', it, i, j, x.toString());
// }
var a = x,
b = x,
c = q;
@ -433,3 +442,78 @@ function pqPrimeLong(what) {
return [bytesFromHex(P.toString(16)), bytesFromHex(Q.toString(16))];
}
function pqPrimeLeemon (what) {
var minBits = 64,
minLen = Math.ceil(minBits / bpe) + 1,
it = 0, i, q, j, lim, g, P, Q,
a = new Array(minLen),
b = new Array(minLen),
c = new Array(minLen),
g = new Array(minLen),
z = new Array(minLen),
x = new Array(minLen),
y = new Array(minLen);
for (i = 0; i < 3; i++) {
q = (nextRandomInt(128) & 15) + 17;
copyInt_(x, nextRandomInt(1000000000) + 1);
copy_(y, x);
lim = 1 << (i + 18);
for (j = 1; j < lim; j++) {
++it;
copy_(a, x);
copy_(b, x);
copyInt_(c, q);
while (!isZero(b)) {
if (b[0] & 1) {
add_(c, a);
if (greater(c, what)) {
sub_(c, what);
}
}
add_(a, a);
if (greater(a, what)) {
sub_(a, what);
}
rightShift_(b, 1);
}
copy_(x, c);
if (greater(x,y)) {
copy_(z, x);
sub_(z, y);
} else {
copy_(z, y);
sub_(z, x);
}
eGCD_(z, what, g, a, b);
if (!equalsInt(g, 1)) {
break;
}
if ((j & (j - 1)) == 0) {
copy_(y, x);
}
}
if (greater(g, one)) {
break;
}
}
divide_(what, g, x, y);
if (greater(g, x)) {
P = x;
Q = g;
} else {
P = g;
Q = x;
}
// console.log(dT(), 'done', bigInt2str(what, 10), bigInt2str(P, 10), bigInt2str(Q, 10));
return [bytesFromLeemonBigInt(P), bytesFromLeemonBigInt(Q)];
}

3
js/lib/pq_worker.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.1.8 - messaging web application for MTProto
* Webogram v0.1.9 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
@ -8,6 +8,7 @@
importScripts(
'../../vendor/console-polyfill/console-polyfill.js',
'bin_utils.js',
'../../vendor/leemon_bigint/bigint.js',
'../../vendor/closure/long.js',
'../../vendor/jsbn/jsbn_combined.js'
);

2
js/lib/sha1_worker.js

@ -1,5 +1,5 @@
/*!
* Webogram v0.1.8 - messaging web application for MTProto
* Webogram v0.1.9 - messaging web application for MTProto
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE

2
manifest.json

@ -1,6 +1,6 @@
{
"name": "Telegram UNOFFICIAL",
"version": "0.1.8",
"version": "0.1.9",
"short_name": "Webogram",
"manifest_version": 2,
"app": {

2
manifest.webapp

@ -1,7 +1,7 @@
{
"name": "Webogram",
"description": "Webogram – UNOFFICIAL Telegram Web App.\nMore info & source code here: https://github.com/zhukov/webogram",
"version": "0.1.8",
"version": "0.1.9",
"type": "privileged",
"launch_path": "/index.html",
"developer": {

1507
vendor/leemon_bigint/bigint.js vendored

File diff suppressed because it is too large Load Diff

3
webogram.appcache

@ -1,5 +1,5 @@
CACHE MANIFEST
# Time: Fri Jun 27 2014 19:23:26 GMT+0400 (MSK)
# Time: Wed Jul 02 2014 20:55:06 GMT+0400 (MSK)
CACHE:
@ -70,6 +70,7 @@ vendor/closure/long.js
vendor/console-polyfill/console-polyfill.js
vendor/cryptoJS/crypto.js
vendor/jsbn/jsbn_combined.js
vendor/leemon_bigint/bigint.js
NETWORK:

Loading…
Cancel
Save