Fix datatypes to use platform independent values, Add command line switch scaffolding

Allow users to chose which bink/channelid they'd like to generate with
Add rudimentary help system, Sanitize user input
This commit is contained in:
Neo
2023-06-01 21:25:43 -07:00
parent e437cc548a
commit 72d441b539
7 changed files with 250 additions and 144 deletions

View File

@@ -5,8 +5,8 @@
#include "header.h"
/* Converts from CD-key to a byte sequence. */
void unbase24(ul32 *byteSeq, const char *cdKey) {
byte pDecodedKey[PK_LENGTH + NULL_TERMINATOR]{};
void unbase24(uint32_t *byteSeq, const char *cdKey) {
uint8_t pDecodedKey[PK_LENGTH + NULL_TERMINATOR]{};
BIGNUM *y = BN_new();
BN_zero(y);
@@ -34,16 +34,16 @@ void unbase24(ul32 *byteSeq, const char *cdKey) {
int n = BN_num_bytes(y);
// Place the generated code into the byte sequence.
BN_bn2bin(y, (byte *)byteSeq);
BN_bn2bin(y, (uint8_t *)byteSeq);
BN_free(y);
// Reverse the byte sequence.
endian((byte *) byteSeq, n);
endian((uint8_t *)byteSeq, n);
}
/* Converts from byte sequence to the CD-key. */
void base24(char *cdKey, ul32 *byteSeq) {
byte rbyteSeq[16];
void base24(char *cdKey, uint32_t *byteSeq) {
uint8_t rbyteSeq[16];
BIGNUM *z;
// Copy byte sequence to the reversed byte sequence.