Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor updates to curve255.js #1

Merged
merged 1 commit into from
Mar 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions js-deps/curve255.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

var c255lbase32chars = "abcdefghijklmnopqrstuvwxyz234567";
var c255lbase32values = {"a":0, "b":1, "c":2, "d":3, "e":4, "f":5, "g":6, "h":7, "i":8, "j":9, "k":10, "l":11, "m":12, "n":13, "o":14, "p":15, "q":16, "r":17, "s":18, "t":19, "u":20, "v":21, "w":22, "x":23, "y":24, "z":25, "2":26, "3":27, "4":28, "5":29, "6":30, "7":31 };
function c255lbase32encode(n, x) {
function c255lbase32encode(n) {
var c;
var r = "";
for (c = 0; c < 255; c+=5) {
r = c255lbase32chars.substr(c255lgetbit(n, c) + c255lgetbit(n, c+1)*2 + c255lgetbit(n, c+2)*4 + c255lgetbit(n, c+3)*8 + c255lgetbit(n, c+4)*16, 1) + r;
}
return r;
}
function c255lbase32decode(n, x) {
function c255lbase32decode(n) {
var c = 0;
var r = c255lzero();
var l = n.length;
Expand All @@ -45,15 +45,15 @@ function c255lbase32decode(n, x) {
}
var c255lhexchars = "0123456789abcdef";
var c255lhexvalues = {"0":0, "1":1, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "a":10, "b":11, "c":12, "d":13, "e":14, "f":15 };
function c255lhexencode(n, x) {
function c255lhexencode(n) {
var c;
var r = "";
for (c = 0; c < 255; c+=4) {
r = c255lhexchars.substr(c255lgetbit(n, c) + c255lgetbit(n, c+1)*2 + c255lgetbit(n, c+2)*4 + c255lgetbit(n, c+3)*8, 1) + r;
}
return r;
}
function c255lhexdecode(n, x) {
function c255lhexdecode(n) {
var c = 0;
var r = c255lzero();
var l = n.length;
Expand Down Expand Up @@ -441,7 +441,7 @@ function curve25519_raw(f, c) {
}

function curve25519b32(a, b) {
return c255lbase32encode(curve25519(c255lbase32decode(a), c255lbase32decode(b)));
return c255lbase32encode(curve25519(c255lbase32decode(a), b && c255lbase32decode(b)));
}

function curve25519(f, c) {
Expand Down