That's what I thought and that was the obvious solution. However, that's not the SoxRok code.... I got this running in Paiza.io (still working on learning C++) That Mod 8 is causing the wrong answer (3m5p5s349p3m). So everybody who used SoxRoks version has the wrong dictionary for 589! I had to rewrite all my code to make the results match SoxRok. Oh well, back to return to the original code! That also means it's the same as 5268!
Code:
#include <iostream>
using namespace std;
#define ATT_NVG5XX_PSK_LEN 13
void genpass589(uint64_t key, unsigned char *psk) {
static const char CHARSET[] = "abcdefghijkmnpqrstuvwxyz23456789#%+=?";
int i;
uint64_t two = key;
psk[ATT_NVG5XX_PSK_LEN - 1] = 0;
for (i = 0; i < 6; i++) { // select character from the charset at given position
int key1 = CHARSET[two % 37];
two /= 37;
int key2 = 50 + (two % 8);
two /= 37;
psk[(10 - (i * 2)) + 1] = key1;
psk[(10 - (i * 2))] = key2;
}
}
int main(void){
uint64_t key=234369665153722384;
unsigned char psk[ATT_NVG5XX_PSK_LEN];
genpass589(key, psk);
cout << psk;
}