Coder Social home page Coder Social logo

Comments (5)

liorko87 avatar liorko87 commented on September 13, 2024

Hello,

libscapi is a library. In order to compile libscapi, please run at the root dir of libscapi the command make.
Afterwards a library that called libscapi will be created. Link to this folder and implement the primitive you need.

Lior

from libscapi.

Zeinab-Rahmani avatar Zeinab-Rahmani commented on September 13, 2024

Thank you so much for the explanation. I linked the libscapi.a to my project.
After that, in order to run the cryptographic hash, I wrote the following codes in qt creator:

image

I appreciate it if you could give me some hints on how to fix the errors and run this hash primitive.
Thank you for your help :).

Meanwhile, I have to mention that I created the input array 'in' and output array 'out' in the following form which I know might not be correct.

char in [2]={'a','b'};
int out[2];

from libscapi.

liorko87 avatar liorko87 commented on September 13, 2024

Please follow the functions signatures.

from libscapi.

Zeinab-Rahmani avatar Zeinab-Rahmani commented on September 13, 2024

I try to follow but I recieve this error:
‘const class std::vector’ has no member named ‘length’

which is related to the following codes:
hash->update(in, 0, in.length);

And these are my new codes:

#include </home/zeinab/libscapi/include/primitives/HashOpenSSL.hpp>
#include
#include
using namespace std;

int main(int argc, char* argv[]){
//create an input array in and an output array out
const vector in {'h', 'i'} ;
vector out;

//create an OpenSSL sha224 function.
CryptographicHash* hash = new OpenSSLSHA224();

//call the update function in the Hash interface.
hash->update(in, 0, in.length);

//get the result of hashing the updated input.
hash->hashFinal(out, 0);
return 0;
}

from libscapi.

Zeinab-Rahmani avatar Zeinab-Rahmani commented on September 13, 2024

Hello,
I think I found the problem, the code hash->update(in, 0, in.length); should be converted to hash->update(in, 0, in.size()); .

In the following there are my codes with no error:

#include "primitives/HashOpenSSL.hpp"
#include
using namespace std;

int main(int argc, char *argv[])
{
//create an input array in and an output array out
const vector in {'h', 'e', 'l', 'l', 'o'};
vector out;

//create  an OpenSSL sha224 function.
CryptographicHash* hash = new OpenSSLSHA224();

//call the update function in the Hash interface.
//void update(const vector<byte> &in, int inOffset, int inLen) override;
hash->update(in, 0, in.size());

//get the result of hashing the updated input.
hash->hashFinal(out, 0);
for(size_t i = 0; i < out.size(); i++){
std::cerr<<out[i]<<""; }
return 0;

}

from libscapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.