git.fiddlerwoaroof.com
Browse code

Reduce token size

Ed Langley authored on 12/06/2017 23:45:03
Showing 2 changed files
... ...
@@ -38,7 +38,7 @@ public:
38 38
         fstreams::pstream stream (fstreams_.open_fstream (file_path));
39 39
 
40 40
         // TODO: ignore newlines
41
-        std::vector<char> line_v(64);
41
+        std::vector<char> line_v(16);
42 42
         stream->read(line_v.data(), line_v.size());
43 43
 
44 44
         if (stream->fail()) {
... ...
@@ -103,7 +103,7 @@ int reads_from_the_right_file ()
103 103
     std::string home_directory = "/somedir";
104 104
     // hardcoded file name is .dual_control in the user's home directory
105 105
     std::string token_file = home_directory + "/.dual_control";
106
-    std::string token ("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
106
+    std::string token ("AAAAAAAAAAAAAAAA");
107 107
 
108 108
     fstreams test_streams (fstreams::delegate (new fake_fstreams (token_file, token)));
109 109
     totp_generator generator (totp_generator::delegate (new fake_totp_generator (token)));
... ...
@@ -148,7 +148,7 @@ int returns_empty_string_if_file_too_short()
148 148
     // hardcoded file name is .dual_control in the user's home directory
149 149
     std::string token_file = home_directory + "/.dual_control";
150 150
     // we want a 40-byte key, so we need a 64-byte base32-encoded file.
151
-    std::string token ("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
151
+    std::string token ("AAAAAAAAAAAAAAA");
152 152
 
153 153
     fstreams test_streams (fstreams::delegate (new fake_fstreams (token_file, token)));
154 154
     totp_generator generator (totp_generator::delegate (new fake_totp_generator (token)));