crypt() is not a function that you can use in bash, it is a c(++) function. If you want to use it you need to write a little c (or c++) script around it. After compiling you'll end up with a binary that can produce the encrypted password needed by useradd's -p option.
This rough example creates md5 encrypted passwords:
int main (int argc, char* argv)
printf ("%s\n", crypt (argv, "$1$"));
/* gcc -lcrypt md5.crypt.c -o md5.crypt */
Save it as md5.crypt.c
. After compiling it with: gcc -lcrypt md5.crypt.c -o md5.crypt
, you'll end up with md5.crypt
An example run:
$ ./md5.crypt FooBar
Hope this helps.