CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
134 lines
2.8 KiB
C++
134 lines
2.8 KiB
C++
// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
|
|
|
|
#include <assert.h>
|
|
#include <rmd160.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
void test1() {
|
|
RMD160_CTX ctx;
|
|
uint8_t entropy[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
|
|
uint8_t digest[RMD160_DIGEST_LENGTH];
|
|
|
|
RMD160Init(&ctx);
|
|
RMD160Update(&ctx, entropy, __arraycount(entropy));
|
|
RMD160Final(digest, &ctx);
|
|
|
|
printf("test1: '");
|
|
for (size_t i = 0; i < __arraycount(digest); i++)
|
|
printf("%02x", digest[i]);
|
|
printf("'\n");
|
|
}
|
|
|
|
void test2() {
|
|
RMD160_CTX ctx;
|
|
uint8_t entropy[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
|
|
char digest[RMD160_DIGEST_STRING_LENGTH];
|
|
|
|
RMD160Init(&ctx);
|
|
RMD160Update(&ctx, entropy, __arraycount(entropy));
|
|
char *p = RMD160End(&ctx, digest);
|
|
assert(p == digest);
|
|
|
|
printf("test2: '%s'\n", digest);
|
|
}
|
|
|
|
void test3() {
|
|
RMD160_CTX ctx;
|
|
uint8_t entropy[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
|
|
|
|
RMD160Init(&ctx);
|
|
RMD160Update(&ctx, entropy, __arraycount(entropy));
|
|
char *p = RMD160End(&ctx, NULL);
|
|
assert(strlen(p) == RMD160_DIGEST_STRING_LENGTH - 1);
|
|
|
|
printf("test3: '%s'\n", p);
|
|
|
|
free(p);
|
|
}
|
|
|
|
void test4() {
|
|
char digest[RMD160_DIGEST_STRING_LENGTH];
|
|
|
|
char *p = RMD160File("/etc/fstab", digest);
|
|
assert(p == digest);
|
|
|
|
printf("test4: '%s'\n", p);
|
|
}
|
|
|
|
void test5() {
|
|
char *p = RMD160File("/etc/fstab", NULL);
|
|
assert(strlen(p) == RMD160_DIGEST_STRING_LENGTH - 1);
|
|
|
|
printf("test5: '%s'\n", p);
|
|
|
|
free(p);
|
|
}
|
|
|
|
void test6() {
|
|
char digest[RMD160_DIGEST_STRING_LENGTH];
|
|
|
|
char *p = RMD160FileChunk("/etc/fstab", digest, 10, 20);
|
|
assert(p == digest);
|
|
|
|
printf("test6: '%s'\n", p);
|
|
}
|
|
|
|
void test7() {
|
|
char *p = RMD160FileChunk("/etc/fstab", NULL, 10, 20);
|
|
assert(strlen(p) == RMD160_DIGEST_STRING_LENGTH - 1);
|
|
|
|
printf("test7: '%s'\n", p);
|
|
|
|
free(p);
|
|
}
|
|
|
|
void test8() {
|
|
uint8_t entropy[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
|
|
char digest[RMD160_DIGEST_STRING_LENGTH];
|
|
|
|
char *p = RMD160Data(entropy, __arraycount(entropy), digest);
|
|
assert(p == digest);
|
|
|
|
printf("test8: '%s'\n", p);
|
|
}
|
|
|
|
void test9() {
|
|
uint8_t entropy[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
|
|
|
|
char *p = RMD160Data(entropy, __arraycount(entropy), NULL);
|
|
assert(strlen(p) == RMD160_DIGEST_STRING_LENGTH - 1);
|
|
|
|
printf("test9: '%s'\n", p);
|
|
|
|
free(p);
|
|
}
|
|
|
|
int main(void) {
|
|
printf("RMD160\n");
|
|
|
|
test1();
|
|
test2();
|
|
test3();
|
|
test4();
|
|
test5();
|
|
test6();
|
|
test7();
|
|
test8();
|
|
test9();
|
|
|
|
// CHECK: RMD160
|
|
// CHECK: test1: '2787e5a006365df6e8e799315b669dc34866783c'
|
|
// CHECK: test2: '2787e5a006365df6e8e799315b669dc34866783c'
|
|
// CHECK: test3: '2787e5a006365df6e8e799315b669dc34866783c'
|
|
// CHECK: test4: '{{.*}}'
|
|
// CHECK: test5: '{{.*}}'
|
|
// CHECK: test6: '{{.*}}'
|
|
// CHECK: test7: '{{.*}}'
|
|
// CHECK: test8: '2787e5a006365df6e8e799315b669dc34866783c'
|
|
// CHECK: test9: '2787e5a006365df6e8e799315b669dc34866783c'
|
|
|
|
return 0;
|
|
}
|