powerdlz23 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/pto/CryptoNoter/.gitattributes +2 -0
  3. package/pto/CryptoNoter/CryptoNight.md +444 -0
  4. package/pto/CryptoNoter/CryptoNight.txt +364 -0
  5. package/pto/CryptoNoter/LICENSE +21 -0
  6. package/pto/CryptoNoter/README.md +178 -0
  7. package/pto/CryptoNoter/banner +4 -0
  8. package/pto/CryptoNoter/config.json +8 -0
  9. package/pto/CryptoNoter/install.sh +60 -0
  10. package/pto/CryptoNoter/package-lock.json +33 -0
  11. package/pto/CryptoNoter/package.json +16 -0
  12. package/pto/CryptoNoter/server.js +225 -0
  13. package/pto/CryptoNoter/web/demo.html +81 -0
  14. package/pto/CryptoNoter/web/index.html +1 -0
  15. package/pto/CryptoNoter/web/lib/cryptonight-asmjs.min.js +16891 -0
  16. package/pto/CryptoNoter/web/lib/cryptonight-asmjs.min.js.mem +0 -0
  17. package/pto/CryptoNoter/web/lib/cryptonight.wasm +0 -0
  18. package/pto/CryptoNoter/web/processor.js +496 -0
  19. package/pto/CryptoNoter/web/worker.js +5549 -0
  20. package/pto/crypto/README.md +1 -0
  21. package/pto/crypto/aes256cbc/README.md +59 -0
  22. package/pto/crypto/aes256cbc/aes256cbc.go +172 -0
  23. package/pto/crypto/aes256cbc/aes256cbc_test.go +105 -0
  24. package/pto/crypto/aes256cbc/examples_test.go +30 -0
  25. package/pto/crypto/dh64/README.md +84 -0
  26. package/pto/crypto/dh64/c/dh64.c +75 -0
  27. package/pto/crypto/dh64/c/dh64.h +12 -0
  28. package/pto/crypto/dh64/c/dh64_test.c +30 -0
  29. package/pto/crypto/dh64/csharp/dh64.cs +77 -0
  30. package/pto/crypto/dh64/csharp/dh64_test.cs +1074 -0
  31. package/pto/crypto/dh64/go/dh64.go +72 -0
  32. package/pto/crypto/dh64/go/dh64_test.go +1064 -0
  33. package/pto/crypto/mt19937/README.md +30 -0
  34. package/pto/crypto/mt19937/c/mt19937-64.c +180 -0
  35. package/pto/crypto/mt19937/c/mt19937-64.h +96 -0
  36. package/pto/crypto/mt19937/c/mt19937-64.out.txt +401 -0
  37. package/pto/crypto/mt19937/c/mt19937-64test.c +78 -0
  38. package/pto/crypto/mt19937/csharp/mt19937.cs +139 -0
  39. package/pto/crypto/mt19937/csharp/mt19937_test.cs +574 -0
  40. package/pto/crypto/mt19937/go/COPYING +674 -0
  41. package/pto/crypto/mt19937/go/README.rst +103 -0
  42. package/pto/crypto/mt19937/go/doc.go +35 -0
  43. package/pto/crypto/mt19937/go/example.go +32 -0
  44. package/pto/crypto/mt19937/go/mt19937.go +149 -0
  45. package/pto/crypto/mt19937/go/mt19937_test.go +614 -0
  46. package/pto/crypto/rc4/README.md +14 -0
  47. package/pto/crypto/rc4/csharp/rc4.cs +119 -0
  48. package/pto/crypto/rc4/csharp/rc4_echo_client.cs +78 -0
  49. package/pto/crypto/rc4/go/rc4_echo_client.go +102 -0
  50. package/pto/crypto/rc4/go/rc4_echo_server.go +110 -0
@@ -0,0 +1,72 @@
1
+ package dh64
2
+
3
+ import (
4
+ "math/rand"
5
+ )
6
+
7
+ const (
8
+ p uint64 = 0xffffffffffffffc5
9
+ g uint64 = 5
10
+ )
11
+
12
+ func mul_mod_p(a, b uint64) uint64 {
13
+ var m uint64 = 0
14
+ for b > 0 {
15
+ if b&1 > 0 {
16
+ t := p - a
17
+ if m >= t {
18
+ m -= t
19
+ } else {
20
+ m += a
21
+ }
22
+ }
23
+ if a >= p-a {
24
+ a = a*2 - p
25
+ } else {
26
+ a = a * 2
27
+ }
28
+ b >>= 1
29
+ }
30
+ return m
31
+ }
32
+
33
+ func pow_mod_p(a, b uint64) uint64 {
34
+ if b == 1 {
35
+ return a
36
+ }
37
+ t := pow_mod_p(a, b>>1)
38
+ t = mul_mod_p(t, t)
39
+ if b%2 > 0 {
40
+ t = mul_mod_p(t, a)
41
+ }
42
+ return t
43
+ }
44
+
45
+ func powmodp(a uint64, b uint64) uint64 {
46
+ if a == 0 {
47
+ panic("DH64 zero public key")
48
+ }
49
+ if b == 0 {
50
+ panic("DH64 zero private key")
51
+ }
52
+ if a > p {
53
+ a %= p
54
+ }
55
+ return pow_mod_p(a, b)
56
+ }
57
+
58
+ func KeyPair() (privateKey, publicKey uint64) {
59
+ a := uint64(rand.Uint32())
60
+ b := uint64(rand.Uint32()) + 1
61
+ privateKey = (a << 32) | b
62
+ publicKey = PublicKey(privateKey)
63
+ return
64
+ }
65
+
66
+ func PublicKey(privateKey uint64) uint64 {
67
+ return powmodp(g, privateKey)
68
+ }
69
+
70
+ func Secret(privateKey, anotherPublicKey uint64) uint64 {
71
+ return powmodp(anotherPublicKey, privateKey)
72
+ }