Skip to content

Commit

Permalink
Did the following:
Browse files Browse the repository at this point in the history
- Removed useless null termination
- Deleted outdated comments
- Removed srand(...) as its not used
  • Loading branch information
tilkinsc committed Jun 13, 2023
1 parent af78c82 commit d92e813
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
5 changes: 0 additions & 5 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,13 @@ int main(int argc, char** argv)
// BASE32 Stuff //
////////////////////////////////////////////////////////////////

// Seed random generator
// TODO: use a secure random generator
srand(get_current_time());

const int base32_len = 16; // must be % 8 == 0

// Generate random base32
char base32_new_secret[base32_len + 1];
memset(&base32_new_secret, 0, base32_len + 1);

otp_random_base32(base32_len, base32_new_secret);
base32_new_secret[base32_len] = '\0';
printf("Random Generated BASE32 Secret: `%s`\n", base32_new_secret);

puts(""); // line break for readability
Expand Down
5 changes: 0 additions & 5 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,13 @@ int main(int argc, char** argv)
// BASE32 Stuff //
////////////////////////////////////////////////////////////////

// Seed random generator
// TODO: use a secure random generator
srand(get_current_time());

const int base32_len = 16; // must be % 8 == 0

// Generate random base32
char base32_new_secret[base32_len + 1];
memset(&base32_new_secret, 0, base32_len + 1);

OTP::random_base32(base32_len, base32_new_secret);
base32_new_secret[base32_len] = '\0';
cout << "Random Generated BASE32 Secret: `" << base32_new_secret << "`" << endl;

cout << endl; // line break for readability
Expand Down

0 comments on commit d92e813

Please sign in to comment.