| 156 | // void writeEncryptedFile(FS &fs, String filepath, String& plaintext) |
| 157 | |
| 158 | String encryptString(String &plaintext, const String &password_str) { |
| 159 | String dataStr = xorEncryptDecryptMD5(plaintext, password_str, 10); |
| 160 | String dataStrHex = ""; |
| 161 | |
| 162 | for (size_t i = 0; i < dataStr.length(); i++) dataStrHex += String(dataStr[i], HEX) + " "; |
| 163 | dataStrHex.toUpperCase(); |
| 164 | dataStrHex.trim(); |
| 165 | |
| 166 | String out = "Filetype: Bruce Encrypted File\nVersion: 1\n"; |
| 167 | out += "Algo: XOR\n"; // TODO: add AES |
| 168 | out += "KeyDerivationAlgo: MD5\n"; |
| 169 | out += "KeyDerivationPasses: 10\n"; |
| 170 | out += "Data: " + dataStrHex + "\n"; |
| 171 | |
| 172 | return out; |
| 173 | } |
| 174 | |
| 175 | /* OLD: |
| 176 | String decryptString(String& cypertext, const String& password_str) |
no test coverage detected