Having a Nim sequence:
var buff = newSeq[byte](buffSize)
if you want to get a pointer to the underlying data buffer that is suitable for being passed to a C library, you can simply use:
sha256Update(ctx, addr buff[0], input[i].len.uint)
If your input is a string
, you can use the following:
let str = "abcdefghijklmnopqrstuvwxyz"
sha256Update(ctx, str.cstring, input[i].len.uint)
Here we use sha256Update
from BearSSL library. See How to create a hash using BearSSL for more complete examples.
See also Accessing seq pointer, Use cstring for C binding, and Arrays and Sequences in nim on Nim forum.