MCPcopy Create free account
hub / github.com/BruceDevices/firmware / encryptString

Function encryptString

src/core/passwords.cpp:158–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156// void writeEncryptedFile(FS &fs, String filepath, String& plaintext)
157
158String 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:
176String decryptString(String& cypertext, const String& password_str)

Callers 2

handleUploadFunction · 0.85
encryptFileCallbackFunction · 0.85

Calls 1

xorEncryptDecryptMD5Function · 0.85

Tested by

no test coverage detected