diff --git a/bash/fs.sh b/bash/fs.sh index 71db3a7..567479d 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -76,3 +76,23 @@ fs_wipe() { dd "${@}" fi } + +luks_format() { + local device="${1}" + local passphrase="${2}" + if [ -b "${device}" ]; then + echo "${passphrase}" | + cryptsetup \ + --verbose \ + --batch-mode \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ + --iter-time 4096 \ + --key-size 512 \ + --hash "sha512" \ + --use-random \ + luksFormat \ + "${device}" + fi +}