Nickle is powerful mathematical computer
programming language with
scripting capabilities. The input language vaguely resembles
C. Some things in C which do not translate easily are different, some design choices have been made differently, and a very few features are simply missing (mostly lower level functions having little to do with possible
scientific or computational applications).
Nickle provides the functionality of the standard unix utilities bc, dc and expr, but in a much more feature-rich environment. It is an ideal environment for prototyping complex algorithms, and advanced research into various math fields. Nickle's scripting capabilities make it a nice replacement for spreadsheets in some business applications, and its numeric features complement the limited numeric functionality of more utility-oriented and system adminstration purposed languages such as awk and perl.
The language's homepage is http://nickle.org/. Here is an example of some Nickle code, from that page. This code preforms RSA encryption:
/*
* RSA cryptosystem
* Bart Massey 1999/1
*
* Must first load numbers.5c
*
* note that encryption and decryption commute
*
* set_private_key(p,q,e)
* call with p and q prime, e small random, less than (p-1) * (q-1),
* relatively prime to this quantity. The primes can be
* conveniently generated using the supplied Miller-Rabin code:
* see the function primebits().
*
* set_public_key(n,e)
* set just the public key information for encryption
*
* encrypt(m)
* return the encryption of m
*
* decrypt(c)
* return the decryption of c
*/
namespace RSA {
import Numbers;
global int e; /* encryption exponent */
global int n; /* public key */
global int d = 0; /* decryption exponent (0 for encrypt-only) */
public int function encrypt(int m) {
return bigpowmod(m, e, n);
}
public int function decrypt(int c) {
exception decrypt_public_key();
if (d == 0)
raise decrypt_public_key();
return bigpowmod(c, d, n);
}
public void function set_private_key(int p, int q, int e0) {
int phi = (p - 1) * (q - 1);
n = p * q;
if (e0 % 2 == 0)
e0++;
while (gcd(e0, phi) > 1)
e0 += 2;
e = e0;
d = zminv(e, phi);
}
public void function set_public_key(int n0, int e0) {
n = n0;
e = e0;
d = 0;
}
}