Skip to content

Commit

Permalink
Update concatenation operator from "." to "++"
Browse files Browse the repository at this point in the history
  • Loading branch information
xhliu committed Jul 4, 2019
1 parent aa135f1 commit cdeffa8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/ackermann.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ nCrypt has devised to way to cauculate the value of the Ackermann function using
n = n + 1;
m = m - 1;
// push
stk = num2bin(m, 1) . stk;
stk = num2bin(m, 1) ++ stk;
} else {
stk = num2bin(m - 1, 1) . stk;
stk = num2bin(m, 1) . stk;
stk = num2bin(m - 1, 1) ++ stk;
stk = num2bin(m, 1) ++ stk;
n = n - 1;
}
}
Expand Down
4 changes: 4 additions & 0 deletions docs/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ bytes Operations

Returns subarray from index ``start`` inclusive to ``end`` exclusive.

* ``dataA ++ dataB``

Returns the concatenation of bytes ``dataA`` and bytes ``dataB``.

* ``bytes num2bin(int num, int size)``

Converts a number ``num`` into a bytes array of size ``size``.
Expand Down
5 changes: 2 additions & 3 deletions docs/rabin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ Rabin Signature
loop (12) {
// 256 bits is 32 bytes
bytes slice = y[32 * i : 32 * (i + 1)];
// concatenate
ret = ret . sha256(slice);
ret = ret ++ sha256(slice);
i = i + 1;
}
Expand All @@ -35,7 +34,7 @@ Rabin Signature
public function verifySig(int S, bytes U, bytes m, int lambda, bytes n) {
require(hash160(n) == nHash);
int h = bin2num(hash3072(m . U));
int h = bin2num(hash3072(m ++ U));
require(S * S == h + lambda * bin2num(n));
}
}
2 changes: 1 addition & 1 deletion docs/syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Operators
- left-associative

* - 4
- ``.``
- ``++``
- left-associative

* - 5
Expand Down

0 comments on commit cdeffa8

Please sign in to comment.