diff options
author | John Klug <john.klug@multitech.com> | 2017-03-21 12:31:19 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-03-21 12:31:19 -0500 |
commit | 6179a6109cc0f523fefa15112714ebb54be49eec (patch) | |
tree | 61185ce0d70ee6b6ffbe335c75424c3949d70198 | |
parent | dfca89c7e7f3b972c5f152bb0ae078ec16c11ca1 (diff) | |
download | mts-id-eeprom-6179a6109cc0f523fefa15112714ebb54be49eec.tar.gz mts-id-eeprom-6179a6109cc0f523fefa15112714ebb54be49eec.tar.bz2 mts-id-eeprom-6179a6109cc0f523fefa15112714ebb54be49eec.zip |
Properly initialize the password
-rw-r--r-- | src/hashpwd.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/hashpwd.cpp b/src/hashpwd.cpp index 76e656a..4931d93 100644 --- a/src/hashpwd.cpp +++ b/src/hashpwd.cpp @@ -155,7 +155,7 @@ int badPassword(string &passwd) void usage(void) { cout << "usage:" << endl << - " hashpwd [-v] [[-d did] [-m mac] | [-p password]] salt" << endl << + " mts-hashpwd [-v] [[-d did] [-m mac] | [-p password]] salt" << endl << " -v verbose" << endl << " -d did Device ID (serial #)" << endl << " -m mac Ethernet mac address" << endl << @@ -177,7 +177,7 @@ int main(int argc, char **argv) { case 'v': v = 1; cout << " verbose" <<endl; break; case 'd': d = 1; did = optarg ; (v==1) && cout << "device-id is " << did << endl; break; case 'm': m = 1; mac = optarg ; (v==1) && cout << "Ethernet mac is " << mac << endl; break; - case 'p': p = 1; mac = optarg ; (v==1) && cout << "User defined password is \"" << pwd << "\"" << endl; break; + case 'p': p = 1; pwd = optarg ; (v==1) && cout << "User defined password is \"" << pwd << "\"" << endl; break; case '?': usage(); break; default: cout<<endl; abort(); } @@ -219,9 +219,10 @@ int main(int argc, char **argv) { SHA256_CTX sha256; unsigned char hash[SHA256_DIGEST_LENGTH]; - if (p) + if (p) { + ((v == 1)) && cout << "Password: " << pwd << endl; passwd_str = prefixStream.str() + pwd + salt; - else { + } else { passwd0 = did + "|" + mac; passwdnew = passwd0; |