| ▲ | kvuj 4 hours ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> EVP_EncodeBlock() encodes a full block of input data in f and of length dlen and stores it in t. For every 3 bytes of input provided 4 bytes of output data will be produced. If dlen is not divisible by 3 then the block is encoded as a final block of data and the output is padded such that it is always divisible by 4. Additionally a NUL terminator character will be added. For example if 16 bytes of input data is provided then 24 bytes of encoded data is created plus 1 byte for a NUL terminator (i.e. 25 bytes in total). The length of the data generated without the NUL terminator is returned from the function. My god, you only see this type of horrendous API in C don't you. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | cesarb 2 hours ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> My god, you only see this type of horrendous API in C don't you. This is the appropriate place to put a link to this pair of classics on API design: "How Do I Make This Hard to Misuse?" https://ozlabs.org/~rusty/index.cgi/tech/2008-03-30.html "What If I Don't Actually Like My Users?" https://ozlabs.org/~rusty/index.cgi/tech/2008-04-01.html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | td521534f12 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"No way to prevent this" say users of only language where this regularly happens | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | userbinator 4 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What's "horrendous"? I don't see anything which stands out as being wrong. It specifies exactly the lengths of input and output. gets(), on the other hand, that is "horrendous". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||