style(user/bknpass):Simplify boilerplate
[BK-2020-03.git] / user / bknpass
index c1c1d1a34e657b75de46a83e7b57f329e9f2dde3..678ab7fd8c37d79d26ad3947c408ccb393c02fa2 100755 (executable)
@@ -1,59 +1,32 @@
 #!/bin/bash
-
-# Author: Steven Baltakatei Sandoval (baltakatei.com)
-#
-# License: This bash script, `bknpass`, is licensed under GPLv3 or
-# later by Steven Baltakatei Sandoval:
-#
-#    `bknpass`, an alphanumeric password generator
-#    Copyright (C) 2021  Steven Baltakatei Sandoval (baltakatei.com)
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    A copy of the GNU General Public License may be found at
-#    <https://www.gnu.org/licenses/>.
-#
-# Description: This bash script generates alphanumeric passphrases
-# with a char-count determined by a user-provided number of bits of
-# entropy. The passphrase is then outputted to stdout with a trailing
-# newline. It works as follows:
+# Desc: Generate alphanumeric passphrase with specified bits of entropy.
+# Usage: bknpass [int]
+# Example: bknpass 128
+# Depends: bash, echo, bc, awk, tr, head, Debian 10
+# Version: 0.1.0
+# Note: This bash script generates alphanumeric passphrases
+#   with a char-count determined by a user-provided number of bits of
+#   entropy. The passphrase is then outputted to stdout with a trailing
+#   newline. It works as follows:
 # 
-#   - Prompt user for an integer. This integer is the number of bits
-#     of entropy that the generated password should have.
+#     - Prompt user for an integer. This integer is the number of bits
+#       of entropy that the generated password should have.
 #
-#   - Check if user-provided string is an integer using `bash` regular
-#     expression test.
+#     - Check if user-provided string is an integer using `bash` regular
+#       expression test.
 #
-#   - Calculate the minimum number of bech32 base32 characters
-#     required to encode the specified number of bits of entropy.
+#     - Calculate the minimum number of bech32 base32 characters
+#       required to encode the specified number of bits of entropy.
 #
-#       - This step uses `bc` to calculate a logarithm float string
-#         and `awk` to convert the float into an integer, rounding up.
+#         - This step uses `bc` to calculate a logarithm float string
+#           and `awk` to convert the float into an integer, rounding up.
 #
-#   - Use `tr`, `/dev/urandom`, and `head` to generate a random
-#     alphanumeric string with the length calculated in the previous
-#     step.
+#     - Use `tr`, `/dev/urandom`, and `head` to generate a random
+#       alphanumeric string with the length calculated in the previous
+#       step.
 #
-#   - Use `echo` to display the passphrase in stdout with a trailing
-#     newline.
-#
-# Usage: bknpass [int]
-#
-# Example: bknpass 256
-#
-# Dependencies: bash, echo, bc, awk, tr, head. See end of file
-#
-# Tested on:
-#
-#   - GNU/Linux Debian 10
+#     - Use `echo` to display the passphrase in stdout with a trailing
+#       newline.
 
 
 #==Initialization==
@@ -209,3 +182,6 @@ echo -e "$PASS1"
 #       There is NO WARRANTY, to the extent permitted by law.
 #    
 #       Written by David MacKenzie and Jim Meyering.
+
+# Author: Steven Baltakatei Sandoval
+# License: GPLv3+