summaryrefslogtreecommitdiff
path: root/src/interface/bcryptFfi.urs
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <benjamin@barenblat.name>2013-06-28 18:25:45 -0700
committerGravatar Benjamin Barenblat <benjamin@barenblat.name>2013-06-28 18:47:43 -0700
commitc54c7e3541d548f0d1f206277e9cf04baff07051 (patch)
tree04becd35e1392aa7b3eec59ef9292599f4b3f432 /src/interface/bcryptFfi.urs
Initial commit
Diffstat (limited to 'src/interface/bcryptFfi.urs')
-rw-r--r--src/interface/bcryptFfi.urs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/interface/bcryptFfi.urs b/src/interface/bcryptFfi.urs
new file mode 100644
index 0000000..a2ef47d
--- /dev/null
+++ b/src/interface/bcryptFfi.urs
@@ -0,0 +1,33 @@
+(* bcryptFfi.urs -- low-level FFI to the bcrypt library
+Copyright (C) 2013 Benjamin Barenblat <benjamin@barenblat.name>
+
+This library is free software: you can redistribute it and/or modify it under
+the terms of the GNU Affero General Public License as published by the Free
+Software Foundation, either version 3 of the License, or (at your option) any
+later version.
+
+This library is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+details.
+
+You should have received a copy of the GNU Affero General Public License along
+with this library. If not, see <http://www.gnu.org/licenses/>. *)
+
+(* In contrast to the 'Bcrypt' module, 'BcryptFfi' is a low-level, non-typesafe
+interface to bcrypt. It is memory-safe, though, and it's provided as an
+"escape hatch" when 'Bcrypt's interface is inadequate.
+
+Unlike 'Bcrypt', which is implemented in Ur, 'BcryptFfi' is actually
+implemented in C. This file describes the interface to the bcrypt FFI in Ur.
+The file 'bcrypt.h' describes the interface in C. *)
+
+(* Creates a setting with a pseudorandom salt and the default number of rounds.
+The salt comes from /dev/urandom, which is not a cryptographically secure
+source, but it should be good enough. *)
+val randomSetting : transaction string
+
+(* Runs crypt(3) with the bcrypt algorithm. *)
+val crypt : string (* setting *)
+ -> string (* password *)
+ -> string