File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -116,3 +116,24 @@ Non-deterministically check if a number is prime.
116116local bigint = require "pluto:bigint"
117117print(new bigint(91):isprobableprime(10)) --> false
118118```
119+
120+ ---
121+ ### ` bigint.export `
122+ Exports the bigint to a big-endian binary string.
123+ #### Parameters
124+ 1 . The bigint.
125+ 2 . The minimum number of bytes to return.
126+ ``` pluto
127+ local bigint = require "pluto:bigint"
128+ print(new bigint("1056"):export():tohex()) --> 0420
129+ print(new bigint("1056"):export(4):tohex()) --> 00000420
130+ ```
131+
132+ ---
133+ ### ` bigint.import `
134+ Creates a bigint from a big-endian binary string.
135+ ``` pluto
136+ local bigint = require "pluto:bigint"
137+ print(bigint.import("\x04\x20"):tostring()) --> 1056
138+ print(bigint.import("\x00\x00\x04\x20"):tostring()) --> 1056
139+ ```
You can’t perform that action at this time.
0 commit comments