Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
df4e07bd
Commit
df4e07bd
authored
22 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
(nettle_mpz_sizeinbase_256): New function.
Rev: src/nettle/bignum.c:1.4 Rev: src/nettle/bignum.h:1.3
parent
0c6beb1f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bignum.c
+7
-1
7 additions, 1 deletion
bignum.c
bignum.h
+3
-0
3 additions, 0 deletions
bignum.h
with
10 additions
and
1 deletion
bignum.c
+
7
−
1
View file @
df4e07bd
...
@@ -34,6 +34,12 @@
...
@@ -34,6 +34,12 @@
#include
<assert.h>
#include
<assert.h>
#include
<string.h>
#include
<string.h>
unsigned
nettle_mpz_sizeinbase_256
(
const
mpz_t
x
)
{
return
(
mpz_sizeinbase
(
x
,
2
)
+
7
)
/
8
;
}
void
void
nettle_mpz_get_str_256
(
unsigned
length
,
uint8_t
*
s
,
const
mpz_t
x
)
nettle_mpz_get_str_256
(
unsigned
length
,
uint8_t
*
s
,
const
mpz_t
x
)
{
{
...
@@ -49,7 +55,7 @@ nettle_mpz_get_str_256(unsigned length, uint8_t *s, const mpz_t x)
...
@@ -49,7 +55,7 @@ nettle_mpz_get_str_256(unsigned length, uint8_t *s, const mpz_t x)
}
}
assert
(
mpz_sgn
(
x
)
>=
0
);
assert
(
mpz_sgn
(
x
)
>=
0
);
assert
(
(
mpz_sizeinbase
(
x
,
2
)
+
7
)
/
8
<=
length
);
assert
(
nettle_
mpz_sizeinbase
_256
(
x
)
<=
length
);
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
i
=
0
;
i
<
size
;
i
++
)
{
{
...
...
This diff is collapsed.
Click to expand it.
bignum.h
+
3
−
0
View file @
df4e07bd
...
@@ -29,6 +29,9 @@
...
@@ -29,6 +29,9 @@
#include
<gmp.h>
#include
<gmp.h>
#include
<inttypes.h>
#include
<inttypes.h>
unsigned
nettle_mpz_sizeinbase_256
(
const
mpz_t
x
);
/* Writes an unsigned integer as length octets, using big endian byte
/* Writes an unsigned integer as length octets, using big endian byte
* order. */
* order. */
void
void
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment