--- /dev/null
+John Benediktsson
--- /dev/null
+USING: help.markup help.syntax ;
+IN: checksums.bsd
+
+HELP: bsd
+{ $class-description "BSD checksum algorithm." } ;
+
+ARTICLE: "checksums.bsd" "BSD checksum"
+"The BSD checksum algorithm implements simple and fast 16-bit checksum. It is a commonly used, legacy checksum algorithm implemented in BSD and available through the GNU " { $snippet "sum" } " utility."
+{ $subsections bsd } ;
+
+ABOUT: "checksums.bsd"
--- /dev/null
+USING: checksums.bsd checksums strings tools.test ;
+IN: checksums.bsd
+
+{ 15816 } [ "Wikipedia" bsd checksum-bytes ] unit-test
+{ 47937 } [ 10000 CHAR: a <string> bsd checksum-bytes ] unit-test
--- /dev/null
+! Copyright (C) 2013 John Benediktsson.
+! See http://factorcode.org/license.txt for BSD license.
+USING: checksums kernel math sequences ;
+IN: checksums.bsd
+
+SINGLETON: bsd
+
+M: bsd checksum-bytes ( bytes checksum -- value )
+ drop 0 [
+ [ [ -1 shift ] [ 1 bitand 15 shift ] bi + ] dip
+ + 0xffff bitand
+ ] reduce ;
+
+INSTANCE: bsd checksum
--- /dev/null
+BSD checksum algorithm