Does the crypto package or any other implements the cryptographic hash function Keccak 256?
Ryan will know - but I believe you can use (crypto-factories)
to seea list. https://docs.racket-lang.org/crypto/factory.html?q=crypto
Yeah this is known. Sorry I have not found time to fix it yet. Hopefully tomorrow.
Done
@mzuppichin has joined the channel
Im a bit confuse about c-structs in ffi. When using a constructor it returns a c-pointer to a struct. If I had to use a functoon that accepts a struct instead of a pointer, I just need to do ptr-ref on my c-pointer struct?
It should “just work”. For example, from my CSFML package:
(define-cstruct _sfVector2f
([x _float]
[y _float]))
(define-sfml sfSprite_setPosition
(_fun _sfSprite* _sfVector2f -> _void))
I can just just do:
(sfSprite_setPosition (sprite) (make-sfVector2f x y))
And it “just works”
Then, a c-struct in Racket works in both pointer and non-pointer arguments?
I believe so, and it just compiles to the right thing based on the type signature of the function.
If someone else knows better, though, I hope they chime in.
Another question about ffi. I need to generate a pointer pointing to an “array” of objects of type A. That is, I need
A* val;
where val points to an “array” of As. How can I achieve this? Also, I would like to be able to use the constructor to inotialize every object A.
The only solution I can think of is to use malloc to allocate the array, create each object A using its constructor and then copy each A into the array using memcpy.
Yes, that’s correct
Yes, that works. You can also use a ctype constructed with _array
, but it amounts to the same thing and may not be convenient if the number of elements varies.
Omg, thats awesome. I was doing castings everywhere
Thanks!
No. The crypto package supports SHA3–256, but not KECCAK–256. I don’t think any of the underlying libraries (openssl, nettle, etc) support it.
Hello all. I am having trouble with the GUI toolkit. I have a pasteboard%
in which I am embedding another pasteboard%
as a snip using editor-snip%
. I then try to display other snips (just regular snip%
objects) inside the editor-snip%
, but their draw
method never fires. The get-extant
method does get called, however. I can’t figure out if I am doing something wrong or not. The snip I am trying to display in the editor-snip%
seems fine, because it displays as expected in the top-level pasteboard%
. Edit: A code sample is attached below.
By “display other snips” I mean inserting them into the underlying editor of the editor-snip%.