Prvni funkcni verze
This commit is contained in:
parent
5d3c79fe91
commit
c57205059e
@ -1,3 +1,5 @@
|
|||||||
|
#include "encipheredEEPROMStrings.h"
|
||||||
|
#include <EEPROM.h>
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "user_interface.h"
|
#include "user_interface.h"
|
||||||
@ -20,7 +22,6 @@ String EES_readString(unsigned int start, size_t maxlen)
|
|||||||
uint32_t cid = ESP_getChipId();
|
uint32_t cid = ESP_getChipId();
|
||||||
uint32_t *pkey = (uint32_t *)&key[0];
|
uint32_t *pkey = (uint32_t *)&key[0];
|
||||||
*pkey = cid;
|
*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)))
|
if ((top > 0) && (top < (maxlen - 2)))
|
||||||
{
|
{
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
@ -37,7 +38,6 @@ String EES_readString(unsigned int start, size_t maxlen)
|
|||||||
b = EEPROM.read(i) ^ key[enciphidx];
|
b = EEPROM.read(i) ^ key[enciphidx];
|
||||||
if (b != 0)
|
if (b != 0)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("_readString error! (%s)\r\n", result.c_str());
|
|
||||||
result = F(""); // spatna ukoncovaci nula - neplatny retezec
|
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 cid = ESP_getChipId();
|
||||||
uint32_t *pkey = (uint32_t *)&key[0];
|
uint32_t *pkey = (uint32_t *)&key[0];
|
||||||
*pkey = cid;
|
*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)
|
EEPROM.write(start, (uint8_t)top); // ulozime delku retezce (pouzite pr kontrolu pri vycitani)
|
||||||
for (i = start + 1; i < start + top + 1; ++i)
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Retezce jsou ulozeny jednoduse sifrovane pomoci XOR sifry.
|
* Retezce jsou ulozeny jednoduse sifrovane pomoci XOR sifry.
|
||||||
* @author Pavel Brychta http://www.xpabo.cz
|
* @author Pavel Brychta http://www.xpabo.cz
|
||||||
*/
|
*/
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cteni sifrovanych retezcu z EEPROM
|
* @brief Cteni sifrovanych retezcu z EEPROM
|
||||||
|
Loading…
Reference in New Issue
Block a user