In this example we used the blowfish algorithm(-c) with a 64 bit key (-s) and we use /dev/urandom as our key file (-d).
Note! If you decide to take the default algorithm (AES), you need to supply "-s 256" instead of "-s 64", because AES has a different-sized key.

Also make sure the dm_mod module is automatically loaded at boot so dmsetup is able to map the device.

# nano /etc/rc.conf

EDIT:
# Modules to load at boot-up (in this order)
# - prefix a module with a ! to blacklist it
#
MODULES=(aes blowfish dm_crypt)

Also change the swap entry in /etc/fstab to point to /dev/mapper/swap0 so a call to swapon -a won't try to mount the unencrypted swap partition. (Note: this is not very important, swapon will report an error about the device being busy).