[DEV] uptate new lutin declaration model

This commit is contained in:
Edouard DUPIN 2021-10-25 07:45:11 +02:00
parent dc87bfc752
commit 69a41f3322
4 changed files with 65 additions and 46 deletions

38
GLD_algue.json Normal file
View File

@ -0,0 +1,38 @@
{
"type":"LIBRARY",
"group-id":"com.atria-soft",
"description":"Algorithm generic",
"license":"MPL-2",
"license-file":"file://LICENCE.txt",
"maintainer":"file://authors.txt",
"author":"file://authors.txt",
"version":"file://version.txt",
"code-quality":"MEDIUM",
"source": [
"algue/debug.cpp",
"algue/base64.cpp",
"algue/sha1.cpp",
"algue/sha512.cpp",
"algue/md5.cpp"
],
"header": [
"algue/base64.hpp",
"algue/sha1.hpp",
"algue/sha512.hpp",
"algue/md5.hpp"
],
"path":[
"."
],
"compilation-version": {
"language": "c++",
"version": 2017
},
"dependency": [
"elog",
"etk",
"crypto",
"ememory"
]
}

View File

@ -264,3 +264,29 @@ etk::Vector<uint8_t> algue::sha512::encodeFromFile(const etk::Uri& _uri) {
return ctx.finalize();
}
etk::Vector<uint8_t> algue::sha512::encodeFromFile(ememory::SharedPtr<etk::io::Interface> _file) {
algue::Sha512 ctx;
if (_file == null) {
ALGUE_ERROR("File Does not exist: ");
etk::Vector<uint8_t> out;
out.resize(ALGUE_DIGEST_SIZE, 0);
}
if (_file->open(etk::io::OpenMode::Read) == false) {
ALGUE_ERROR("Can not open (r) the file: ");
etk::Vector<uint8_t> out;
out.resize(ALGUE_DIGEST_SIZE, 0);
}
_file->seek(0, etk::io::SeekMode::Start);
uint32_t bufferSize = 4096;
uint8_t buffer[bufferSize];
while (bufferSize == 4096) {
bufferSize = _file->read(buffer, 1, bufferSize);
if (bufferSize != 0) {
ctx.update(buffer, bufferSize);
}
}
_file->close();
return ctx.finalize();
}

View File

@ -41,6 +41,7 @@ namespace algue {
return algue::sha512::encode(reinterpret_cast<const uint8_t*>(&_data[0]), _data.size());
}
etk::Vector<uint8_t> encodeFromFile(const etk::Uri& _uri);
etk::Vector<uint8_t> encodeFromFile(ememory::SharedPtr<etk::io::Interface> _file);
}
etk::String stringConvert(etk::Vector<uint8_t> _data);
}

View File

@ -1,46 +0,0 @@
#!/usr/bin/python
import lutin.debug as debug
import lutin.tools as tools
def get_type():
return "LIBRARY"
def get_desc():
return "Algorithm generic"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
def get_compagny_name():
return "atria-soft"
def get_maintainer():
return "authors.txt"
def get_version():
return "version.txt"
def configure(target, my_module):
my_module.add_depend(['elog', 'etk', 'crypto'])
my_module.add_extra_flags()
my_module.add_src_file([
'algue/debug.cpp',
'algue/base64.cpp',
'algue/sha1.cpp',
'algue/sha512.cpp',
'algue/md5.cpp'
])
my_module.add_header_file([
'algue/base64.hpp',
'algue/sha1.hpp',
'algue/sha512.hpp',
'algue/md5.hpp',
])
my_module.add_path(".")
return True