Skip to content

Commit 29ebc88

Browse files
committed
Initial commit
1 parent 8cd82d6 commit 29ebc88

File tree

92 files changed

+15592
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+15592
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

404.html

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
<meta http-equiv="Content-Language" content="en-us" />
6+
<meta http-equiv="imagetoolbar" content="false" />
7+
<meta name="MSSmartTagsPreventParsing" content="true" />
8+
<title>404 error | Forknote.net</title>
9+
<link rel="alternate" type="application/atom+xml" title="API Changes" href="/blog.atom" />
10+
<link href="/css/reset.css" rel="stylesheet" type="text/css" />
11+
<link href="/css/documentation.css" media="screen" rel="stylesheet" type="text/css">
12+
<link href="/css/pygments.css" media="screen" rel="stylesheet" type="text/css">
13+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
14+
<script src="/js/jquery.js" type="text/javascript"></script>
15+
<script src="/js/documentation.js" type="text/javascript"></script>
16+
</head>
17+
18+
19+
<body class="overview ">
20+
<div id="header-wrapper">
21+
<div id="header">
22+
<div>
23+
<a class="logo" href="/">Forknote</a>
24+
<ul class="nav">
25+
<li><a href="/download/" class="nav-download">Download</a></li>
26+
<li><a href="/coins/" class="nav-coins">Coins</a></li>
27+
<li><a href="/developers/" class="nav-developers">Developers</a></li>
28+
<li><a href="/blog/" class="nav-blog">Blog</a></li>
29+
<li><a href="/contact/" class="nav-contact">Support</a></li>
30+
<li id="search-container">
31+
<input type="text" id="searchfield" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /><label class="search-placeholder">Search</label>
32+
<div class="cancel-search"></div>
33+
<ul id="search-results">
34+
35+
</ul>
36+
</li>
37+
</ul>
38+
</div>
39+
</div><!-- #header -->
40+
</div><!-- #header-wrapper -->
41+
42+
43+
44+
<div id="wrapper">
45+
<div class="content">
46+
47+
<h1>404 error</h1>
48+
49+
The page you are looking for does not exist.
50+
51+
<div>
52+
</div>
53+
</div>
54+
</div>
55+
56+
57+
<div id="footer" >
58+
<div class="lower_footer">
59+
<ul class="footer-cell">
60+
<li><a href="https://bytecoin.org">Based on Bytecoin</a></li>
61+
<li><a href="https://cryptonote.org">Cryptonote technology</a></li>
62+
</ul>
63+
64+
<span class="footer-cell">
65+
<a href="http://forknote.net/" class="mega-octicon forknote-small"></a>
66+
</span>
67+
68+
<ul class="footer-cell">
69+
<li><a href="https://github.com/forknote/forknote">Source code</a></li>
70+
<li><a href="https://twitter.com/forknote_dev">Twitter</a></li>
71+
<li><a href="https://bitcointalk.org/index.php?topic=1079306.0">Bitcointalk</a></li>
72+
</ul>
73+
</div>
74+
75+
<div class="wrapper">
76+
<p>&copy; <span class="js-year"></span> Forknote. All rights reserved.</p>
77+
</div>
78+
79+
</div><!-- /#footer -->
80+
81+
<script>
82+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
83+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
84+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
85+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
86+
87+
ga('create', 'UA-883823-25', 'auto');
88+
ga('send', 'pageview');
89+
90+
</script>
91+
<script src="/js/retina.js" type="text/javascript"></script>
92+
</body>
93+
</html>

CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
forknote.net

README.md

-1
This file was deleted.

assets/js/base58.js

+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
var cnBase58 = (function () {
2+
var b58 = {};
3+
4+
var alphabet_str = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
5+
var alphabet = [];
6+
for (var i = 0; i < alphabet_str.length; i++) {
7+
alphabet.push(alphabet_str.charCodeAt(i));
8+
}
9+
var encoded_block_sizes = [0, 2, 3, 5, 6, 7, 9, 10, 11];
10+
11+
var alphabet_size = alphabet.length;
12+
var full_block_size = 8;
13+
var full_encoded_block_size = 11;
14+
15+
var UINT64_MAX = new JSBigInt(2).pow(64);
16+
17+
function hextobin(hex) {
18+
if (hex.length % 2 !== 0) throw "Hex string has invalid length!";
19+
var res = new Uint8Array(hex.length / 2);
20+
for (var i = 0; i < hex.length / 2; ++i) {
21+
res[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
22+
}
23+
return res;
24+
}
25+
26+
function bintohex(bin) {
27+
var out = [];
28+
for (var i = 0; i < bin.length; ++i) {
29+
out.push(("0" + bin[i].toString(16)).slice(-2));
30+
}
31+
return out.join("");
32+
}
33+
34+
function strtobin(str) {
35+
var res = new Uint8Array(str.length);
36+
for (var i = 0; i < str.length; i++) {
37+
res[i] = str.charCodeAt(i);
38+
}
39+
return res;
40+
}
41+
42+
function bintostr(bin) {
43+
var out = [];
44+
for (var i = 0; i < bin.length; i++) {
45+
out.push(String.fromCharCode(bin[i]));
46+
}
47+
return out.join("");
48+
}
49+
50+
function uint8_be_to_64(data) {
51+
if (data.length < 1 || data.length > 8) {
52+
throw "Invalid input length";
53+
}
54+
var res = JSBigInt.ZERO;
55+
var twopow8 = new JSBigInt(2).pow(8);
56+
var i = 0;
57+
switch (9 - data.length) {
58+
case 1:
59+
res = res.add(data[i++]);
60+
case 2:
61+
res = res.multiply(twopow8).add(data[i++]);
62+
case 3:
63+
res = res.multiply(twopow8).add(data[i++]);
64+
case 4:
65+
res = res.multiply(twopow8).add(data[i++]);
66+
case 5:
67+
res = res.multiply(twopow8).add(data[i++]);
68+
case 6:
69+
res = res.multiply(twopow8).add(data[i++]);
70+
case 7:
71+
res = res.multiply(twopow8).add(data[i++]);
72+
case 8:
73+
res = res.multiply(twopow8).add(data[i++]);
74+
break;
75+
default:
76+
throw "Impossible condition";
77+
}
78+
return res;
79+
}
80+
81+
function uint64_to_8be(num, size) {
82+
var res = new Uint8Array(size);
83+
if (size < 1 || size > 8) {
84+
throw "Invalid input length";
85+
}
86+
var twopow8 = new JSBigInt(2).pow(8);
87+
for (var i = size - 1; i >= 0; i--) {
88+
res[i] = num.remainder(twopow8).toJSValue();
89+
num = num.divide(twopow8);
90+
}
91+
return res;
92+
}
93+
94+
b58.encode_block = function (data, buf, index) {
95+
if (data.length < 1 || data.length > full_encoded_block_size) {
96+
throw "Invalid block length: " + data.length;
97+
}
98+
var num = uint8_be_to_64(data);
99+
var i = encoded_block_sizes[data.length] - 1;
100+
// while num > 0
101+
while (num.compare(0) === 1) {
102+
var div = num.divRem(alphabet_size);
103+
// remainder = num % alphabet_size
104+
var remainder = div[1];
105+
// num = num / alphabet_size
106+
num = div[0];
107+
buf[index + i] = alphabet[remainder.toJSValue()];
108+
i--;
109+
}
110+
return buf;
111+
};
112+
113+
b58.encode = function (hex) {
114+
var data = hextobin(hex);
115+
if (data.length === 0) {
116+
return "";
117+
}
118+
var full_block_count = Math.floor(data.length / full_block_size);
119+
var last_block_size = data.length % full_block_size;
120+
var res_size = full_block_count * full_encoded_block_size + encoded_block_sizes[last_block_size];
121+
122+
var res = new Uint8Array(res_size);
123+
var i;
124+
for (i = 0; i < res_size; ++i) {
125+
res[i] = alphabet[0];
126+
}
127+
for (i = 0; i < full_block_count; i++) {
128+
res = b58.encode_block(data.subarray(i * full_block_size, i * full_block_size + full_block_size), res, i * full_encoded_block_size);
129+
}
130+
if (last_block_size > 0) {
131+
res = b58.encode_block(data.subarray(full_block_count * full_block_size, full_block_count * full_block_size + last_block_size), res, full_block_count * full_encoded_block_size)
132+
}
133+
return bintostr(res);
134+
};
135+
136+
b58.decode_block = function (data, buf, index) {
137+
if (data.length < 1 || data.length > full_encoded_block_size) {
138+
throw "Invalid block length: " + data.length;
139+
}
140+
141+
var res_size = encoded_block_sizes.indexOf(data.length);
142+
if (res_size <= 0) {
143+
throw "Invalid block size";
144+
}
145+
var res_num = new JSBigInt(0);
146+
var order = new JSBigInt(1);
147+
for (var i = data.length - 1; i >= 0; i--) {
148+
var digit = alphabet.indexOf(data[i]);
149+
if (digit < 0) {
150+
throw "Invalid symbol";
151+
}
152+
var product = order.multiply(digit).add(res_num);
153+
// if product > UINT64_MAX
154+
if (product.compare(UINT64_MAX) === 1) {
155+
throw "Overflow";
156+
}
157+
res_num = product;
158+
order = order.multiply(alphabet_size);
159+
}
160+
if (res_size < full_block_size && (new JSBigInt(2).pow(8 * res_size).compare(res_num) <= 0)) {
161+
throw "Overflow 2";
162+
}
163+
buf.set(uint64_to_8be(res_num, res_size), index);
164+
return buf;
165+
};
166+
167+
b58.decode = function (enc) {
168+
enc = strtobin(enc);
169+
if (enc.length === 0) {
170+
return "";
171+
}
172+
var full_block_count = Math.floor(enc.length / full_encoded_block_size);
173+
var last_block_size = enc.length % full_encoded_block_size;
174+
var last_block_decoded_size = encoded_block_sizes.indexOf(last_block_size);
175+
if (last_block_decoded_size < 0) {
176+
throw "Invalid encoded length";
177+
}
178+
var data_size = full_block_count * full_block_size + last_block_decoded_size;
179+
var data = new Uint8Array(data_size);
180+
for (var i = 0; i < full_block_count; i++) {
181+
data = b58.decode_block(enc.subarray(i * full_encoded_block_size, i * full_encoded_block_size + full_encoded_block_size), data, i * full_block_size);
182+
}
183+
if (last_block_size > 0) {
184+
data = b58.decode_block(enc.subarray(full_block_count * full_encoded_block_size, full_block_count * full_encoded_block_size + last_block_size), data, full_block_count * full_block_size);
185+
}
186+
return bintohex(data);
187+
};
188+
189+
return b58;
190+
})();

0 commit comments

Comments
 (0)