Prvni funkcni verze

This commit is contained in:
Pavel Brychta 2018-12-11 08:29:06 +01:00
parent 5d3c79fe91
commit c57205059e
2 changed files with 3 additions and 4 deletions

View File

@ -1,3 +1,5 @@
#include "encipheredEEPROMStrings.h"
#include <EEPROM.h>
#if defined(ESP8266)
extern "C" {
#include "user_interface.h"
@ -20,7 +22,6 @@ String EES_readString(unsigned int start, size_t maxlen)
uint32_t cid = ESP_getChipId();
uint32_t *pkey = (uint32_t *)&key[0];
*pkey = cid;
DEBUG_MSG("Key = %02X:%02X:%02X:%02X\r\n", key[0], key[1], key[2], key[3]);
if ((top > 0) && (top < (maxlen - 2)))
{
uint8_t b;
@ -37,7 +38,6 @@ String EES_readString(unsigned int start, size_t maxlen)
b = EEPROM.read(i) ^ key[enciphidx];
if (b != 0)
{
DEBUG_MSG("_readString error! (%s)\r\n", result.c_str());
result = F(""); // spatna ukoncovaci nula - neplatny retezec
}
}
@ -65,7 +65,6 @@ bool EES_storeString(unsigned int start, size_t maxlen, String &string)
uint32_t cid = ESP_getChipId();
uint32_t *pkey = (uint32_t *)&key[0];
*pkey = cid;
DEBUG_MSG("Key = %02X:%02X:%02X:%02X\r\n", key[0], key[1], key[2], key[3]);
EEPROM.write(start, (uint8_t)top); // ulozime delku retezce (pouzite pr kontrolu pri vycitani)
for (i = start + 1; i < start + top + 1; ++i)
{
@ -81,4 +80,3 @@ bool EES_storeString(unsigned int start, size_t maxlen, String &string)
return result;
}

View File

@ -2,6 +2,7 @@
* Retezce jsou ulozeny jednoduse sifrovane pomoci XOR sifry.
* @author Pavel Brychta http://www.xpabo.cz
*/
#include <Arduino.h>
/**
* @brief Cteni sifrovanych retezcu z EEPROM