Official chibi-scheme repository
Find a file
ilammy baff1af72d chibi.crypto: native SHA-2 implementation
The original Scheme implementation is astonishingly slow. Rewriting
SHA-2 in C yields around x10000 speed boost for premade strings and
bytevectors. For input ports this is alleviated to x100 boost.

The implementation is divided into two parts: native computational
backend and thin Scheme interface. It is tedious to properly do IO
from C, so the Scheme code handles reading data from an input port
and the C code performs actual computations on byte buffers (which
is also used to handle strings and bytevectors directly).

Scheme wrapper reads data in chunked manner with 'read-bytevector'.
Currently, the chunk size has insignificant impact on performance
as soon as it is bigger than 64. Also, using simply read-bytevector
turned out to be 33% faster than preallocating a buffer and filling
it with read-bytevector!

One tricky part is how to get exact 32-bit integers in C89. We have
no <inttypes.h> there, so instead we use <limits.h> to see whether
we have a standard type with suitable boundaries.

The other one is how to return a properly tagged sha_context from C.
Chibi FFI currently cannot handle the case when a procedure returns
either a C pointer (which needs to be boxed) or an exception (which
should be left as is). To workaround this sexp_start_sha() receives
a dummy argument of type sha_context; this makes Chibi FFI to put a
proper type tag into 'self', which is then extracted in the C code.

This commits adds a new shared library 'crypto$(SO)' with intent to
keep there all native code of (chibi crypto) libraries. This allows
to simply put any future native implementation of SHA-512 or MD5 in
some md5.c and just include those files into crypto.stub.
2015-04-18 17:31:45 +03:00
benchmarks Adding ray tracer benchmark. 2015-04-09 01:38:53 +09:00
build-lib/chibi/char-set Noting some simple char-set utilities are public domain. 2015-04-09 01:43:17 +09:00
contrib Adding -R support to chibi bash completion. 2015-04-09 01:31:36 +09:00
data Adding a gitignore for the temp data dir. 2015-04-09 01:30:06 +09:00
doc Removing uneeded trailing /. 2015-02-15 11:22:11 +09:00
examples Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
include/chibi Merge pull request #251 from ilammy/overflow-fixes 2015-04-15 17:14:58 +09:00
lib chibi.crypto: native SHA-2 implementation 2015-04-18 17:31:45 +03:00
opt Committing removed files. 2015-02-08 16:02:50 +09:00
tests Merge pull request #251 from ilammy/overflow-fixes 2015-04-15 17:14:58 +09:00
tools Enabling chicken snow installs, and adding to tests. 2015-04-15 15:19:44 +09:00
.gitignore Ignoring generated files from snow tests. 2015-04-09 01:10:01 +09:00
.hgignore Emscripten support by default. Patch from Marc Nieper-Wi?kirchen. 2015-02-22 16:10:30 +09:00
AUTHORS Adding Alexei Lozovsky to AUTHORS. 2015-04-15 17:20:31 +09:00
bignum.c Merge pull request #251 from ilammy/overflow-fixes 2015-04-15 17:14:58 +09:00
chibi-scheme.pc.in Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
chibi-scheme.vcproj Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
COPYING Updating copyright years. 2015-04-09 01:28:02 +09:00
eval.c Avoiding potential segfault from trying to capture temporary local variables in a macro. 2015-04-14 23:22:48 +09:00
fedora.spec Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
gc.c Updating copyright years. 2015-04-09 01:28:02 +09:00
main.c Updating copyright years. 2015-04-09 01:28:02 +09:00
Makefile chibi.crypto: native SHA-2 implementation 2015-04-18 17:31:45 +03:00
Makefile.detect Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
Makefile.libs Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
mkfile Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
opcodes.c Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
plan9.c Updating copyright years. 2015-04-09 01:28:02 +09:00
README Clarifying default language. 2015-04-09 01:24:07 +09:00
README.libs Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
RELEASE Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00
sexp.c Clean up unused var warning. Fixes issue #256. 2015-04-16 08:37:51 +09:00
simplify.c Updating copyright years. 2015-04-09 01:28:02 +09:00
TODO Updating some completed items. 2015-04-09 01:22:52 +09:00
VERSION changes go to the 0.7.3 release 2015-03-22 17:02:41 +09:00
vm.c Updating copyright years. 2015-04-09 01:28:02 +09:00

                             Chibi-Scheme
                            --------------
                                   
    Minimal Scheme Implementation for use as an Extension Language

              http://synthcode.com/wiki/chibi-scheme/

Chibi-Scheme is a very small library intended for use as an extension
and scripting language in C programs.  In addition to support for
lightweight VM-based threads, each VM itself runs in an isolated heap
allowing multiple VMs to run simultaneously in different OS threads.

The default repl language contains all bindings from R7RS small,
available explicitly as the (scheme small) library.

Support for additional languages such as JavaScript, Go, Lua and Bash
are planned for future releases.  Scheme is chosen as a substrate
because its first class continuations and guaranteed tail-call
optimization makes implementing other languages easy.

To build on most platforms just run "make && make test".  This will
provide a shared library "libchibi-scheme", as well as a sample
"chibi-scheme" command-line repl.  You can then run

  sudo make install

to install the binaries and libraries.  You can optionally specify a
PREFIX for the installation directory:

  make PREFIX=/path/to/install/
  sudo make PREFIX=/path/to/install/ install

By default files are installed in /usr/local.

If you want to try out chibi-scheme without installing, be sure to set
LD_LIBRARY_PATH so it can find the shared libraries.

For more detailed documentation, run "make doc" and see the generated
"doc/chibi.html".