Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Мотыгуллин Амир Булатович
libakrypt-motygullin-pcdch
Commits
efdfc2e4
Commit
efdfc2e4
authored
2 months ago
by
Мотыгуллин Амир Булатович
Browse files
Options
Download
Patches
Plain Diff
Update test.c
parent
dae89a91
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/tests/randtest.c
+42
-42
examples/tests/randtest.c
with
42 additions
and
42 deletions
+42
-42
examples/tests/test.c
→
examples/tests/
rand
test.c
+
42
−
42
View file @
efdfc2e4
/* --------------------------------------------------------------------------------- */
/* example-g03n01.c */
/* --------------------------------------------------------------------------------- */
#include
<stdio.h>
#include
<libakrypt.h>
#include
<unistd.h>
int
main
(
void
)
{
/* , */
int
error
=
ak_error_ok
;
/* */
int
exitstatus
=
EXIT_FAILURE
;
/* */
struct
bckey
ctx
;
struct
random
rnd
;
/* */
ak_uint8
generated
[
800
];
ak_uint8
key
[
32
]
=
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0A
,
0x0B
,
0x0C
,
0x0D
,
0x0E
,
0x0F
,
0x10
,
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
,
0x17
,
0x18
,
0x19
,
0x1A
,
0x1B
,
0x1C
,
0x1D
,
0x1E
,
0x1F
,
};
/* */
if
(
ak_libakrypt_create
(
NULL
)
!=
ak_true
)
{
ak_libakrypt_destroy
();
return
EXIT_FAILURE
;
}
ak_bckey_create_magma
(
&
ctx
);
ak_bckey_set_key
(
&
ctx
,
key
,
32
);
ak_random_create_magma
(
&
rnd
,
&
ctx
);
rnd
.
random
(
&
rnd
,
generated
,
800
);
write
(
1
,
"a"
,
1
);
printf
(
"%s
\n\n
"
,
ak_ptr_to_hexstr
(
generated
,
40
,
ak_false
));
printf
(
"%s
\n\n
"
,
ak_ptr_to_hexstr
((
ak_uint8
*
)
generated
+
760
,
40
,
ak_false
));
rnd
.
free
(
&
rnd
);
/* */
if
(
error
==
ak_error_ok
)
exitstatus
=
EXIT_SUCCESS
;
ak_libakrypt_destroy
();
return
exitstatus
;
}
\ No newline at end of file
/* --------------------------------------------------------------------------------- */
/* example-g03n01.c */
/* --------------------------------------------------------------------------------- */
#include
<stdio.h>
#include
<libakrypt.h>
#include
<unistd.h>
int
main
(
void
)
{
/* , */
int
error
=
ak_error_ok
;
/* */
int
exitstatus
=
EXIT_FAILURE
;
/* */
struct
bckey
ctx
;
struct
random
rnd
;
/* */
ak_uint8
generated
[
800
];
ak_uint8
key
[
32
]
=
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0A
,
0x0B
,
0x0C
,
0x0D
,
0x0E
,
0x0F
,
0x10
,
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
,
0x17
,
0x18
,
0x19
,
0x1A
,
0x1B
,
0x1C
,
0x1D
,
0x1E
,
0x1F
,
};
/* */
if
(
ak_libakrypt_create
(
NULL
)
!=
ak_true
)
{
ak_libakrypt_destroy
();
return
EXIT_FAILURE
;
}
ak_bckey_create_magma
(
&
ctx
);
ak_bckey_set_key
(
&
ctx
,
key
,
32
);
ak_random_create_magma
(
&
rnd
,
&
ctx
);
rnd
.
random
(
&
rnd
,
generated
,
800
);
write
(
1
,
"a"
,
1
);
printf
(
"%s
\n\n
"
,
ak_ptr_to_hexstr
(
generated
,
40
,
ak_false
));
printf
(
"%s
\n\n
"
,
ak_ptr_to_hexstr
((
ak_uint8
*
)
generated
+
760
,
40
,
ak_false
));
rnd
.
free
(
&
rnd
);
/* */
if
(
error
==
ak_error_ok
)
exitstatus
=
EXIT_SUCCESS
;
ak_libakrypt_destroy
();
return
exitstatus
;
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets