bytevector=?(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

πŸ‘‘ bytevector=?(3scm) β€” the bytevector equality vibe check πŸ‘‘

okay so this is from the Scheme Programmer's Manual, and we are about to compare two bytevectors like it's our job. no cap. πŸ’…


πŸ’– NAME πŸ’–

bytevector=? β€” compare two bytevectors. that's the whole assignment, bestie. 🫢


πŸ“š LIBRARY πŸ“š

you pull it in from either of these, depending on your R6RS situation:

(import (rnrs))                     ;R6RS
(import (rnrs bytevectors))         ;R6RS

✨ SYNOPSIS ✨

(bytevector=? bytevector1 bytevector2)

🌸 DESCRIPTION 🌸

so bytevector=? hands back #t when bytevector1 and bytevector2 are equal. and equal means they have the same length and equal bytes at all valid indices. if that's not the case, you get #f. periodt. πŸ’–


πŸŽ€ RETURN VALUES πŸŽ€

returns a single boolean object. that's it. one boolean object, living its truth. ✨


πŸ¦‹ EXAMPLES πŸ¦‹

look at these little icons slaying:

(bytevector=? #vu8(1 2 3) #vu8(1 2 3))  =>  #t
(bytevector=? #vu8(1 2 3) #vu8(0 1 2))  =>  #f

🚨 APPLICATION USAGE 🚨

bestie, this is serious: programs that work with sensitive data such as passwords and message digests must never use this procedure with attacker-controlled data.

why? it may leak information through the time it takes to execute, leading to the movie trope where a password is cracked one letter at a time. πŸ’€ no cap, do not do it.


πŸ’… COMPATIBILITY πŸ’…

this procedure is absent from R7RS. use equal?(3scm) instead. lowkey important. 🫢


😭 ERRORS 😭

this procedure can raise exceptions with the following condition types:

  • &assertion (R6RS) β€” The wrong number of arguments was passed or an argument was outside its domain.

πŸ”₯ SEE ALSO πŸ”₯

equal?(3scm)


πŸ‘‘ STANDARDS πŸ‘‘

R6RS. periodt. πŸ’œ


🌈 AUTHORS 🌈

this page is part of the scheme-manpages project. it includes materials from the RnRS documents. more information can be found at https://github.com/schemedoc/manpages/. 🧚


sign-off 🌸: this page is from the Scheme Programmer's Manual, dated 2021-02-28, and it's the bytevector=?(3scm) page. mwah. πŸ’–

πŸ“¦ where this page comes from