ByteString is a small utility library that provides a conceptually immutable byte string type with many convenient operations.


To build ByteString from source you will need an F# 3.1 compiler and .NET development environment. The .sln and .fsproj files in the source directories should be understood by .NET Core command line tools, MSBuild or IDEs such as VSCode or VisualStudio.


ByteString is a library. Basic usage may look like this:

#r "Murphy.ByteString"
open Murphy.ByteString

let b = ByteString.FromString("Hello world!")
printfn "Message digest: %s" <| b.GetHash("SHA-256").ToHexadecimal()

A variety of conversion operations, binary operators and standard interfaces are provided for byte strings. None of these modify the data represented by the instances they operate on.

However, the byte string type encapsulates a byte array and for efficiency, a few operations allow access to this raw array. These operations are marked with "unsafe" in their names and should be used with care.