Do we have Hashlib in Zerynth ?


#1

I’m working on implementing a minimal WebSocket server. 

To complete handshake with client I have to generate key using SHA1.

Do Zerynth has such library ?

Thanks


#2

Hi @anba 

Could you please confirm if Zerynth has a library for SHA1 calculation ?

Apologies if you are not the right person to ask.

Thanks
Mohsin 


#3

Hello @mohsinkhan ,

congratz on the very nice project you are developing and sotty for the late answer.

Regarding your question, Zerynth does not have a hashlib library at the moment, however SHA1  can be easily implemented by embedding an existing C library and calling it from Python.

For example, you could use something like this, and exploiting the Zerynth C language interface here you can get the result back to a Python string or bytearray.

Alternatively you can use some pure Python implementation like this one, adapting it for the missing Zerynth modules.

If you are interested in one of these approaches, we can support you here in the forum to get the project going.


#4

Thanks @Giacomo 

I’ll try these approaches.