i figured out a novel way of creating stacks of headerles dm-crypt on top of eachother eaco with their own cipher and hash the user provides a "cipher phrase" at runtime, and it will go through a sha256 function, which is used to deterministically decide which cipher type and hash algo to use at each level, from a pool of given ciphers my current implementation is called abysscrypt: https://github.com/hairetikos/abysscrypt Cipher-phrasing is the mechanism that makes each encryption level use a different cipher and hash algorithm, derived from a secret you supply at runtime rather than hard-coded in the command line. The problem it solves: Plain dm-crypt has no header -- there is no on-disk signature identifying the cipher. But if an attacker already knows (or guesses) that you use aes-xts-plain64 for every level, they have one less unknown when attempting to break the stack. With a fixed cipher and hash an attacker also knows exactly which algorithm to attack at each layer. Cipher-phrasing removes that knowledge. Without the cipher phrase, an attacker cannot determine which cipher or hash was used at any level, even if they obtain the raw ciphertext. How it works At mount time you are prompted for two secrets in addition to your passphrase: Cipher phrase: used to select the cipher for each level. Hash phrase: used independently to select the hash. If left blank, the cipher phrase is reused for both selections. For each level N, the index into the cipher pool and hash pool is derived as: cipher_idx = SHA-256( cipher_phrase || 'C' || decimal(N) ) mod n_ciphers hash_idx = SHA-256( hash_phrase || 'H' || decimal(N) ) mod n_hashes The domain bytes 'C' and 'H' prevent the cipher and hash derivations from producing correlated indices even when the same phrase is used for both. The derivation is deterministic: the same phrase always produces the same per-level mapping. This means: A correct phrase always opens the same stack. A wrong phrase opens different levels with wrong ciphers and silently produces garbage there is no error message to tell an attacker they guessed incorrectly. The mapping is secret: without the phrase, the per-level cipher/hash schedule is computationally indistinguishable from random selection. No script, no config file nothing to recover In the old GUI era, the wizard generated a shell script that encoded the exact cipher and hash for every level. An attacker who obtained that script had the full encryption recipe. In the C binary there is no such artifact. The entire cipher/hash schedule is computed on the fly from the phrase you type at mount time. Nothing is written to disk. There is no config file, no script, no key file, no database. The only record of the per-level mapping is in your memory (and optionally a dry-run printout you keep yourself). An attacker who obtains the container file and the binary cannot determine how many levels it has, which ciphers were used, or even whether it is an abysscrypt volume at all plain dm-crypt leaves no on-disk header. Without the cipher phrase and the passphrase, the container is indistinguishable from random noise. Pool size and uncertainty The larger the cipher and hash pools, the more combinations an attacker must consider. With the default pools (3 ciphers 4 hashes) there are 12 possible cipher/hash pairs per level. For a 33-level stack, the number of possible schedules is 12^33 2^118. Adding ciphers via --with-camellia etc. increases this further. Self-contained SHA-256 The derivation uses a SHA-256 implementation embedded directly in the binary. There is no dependency on libssl, libgcrypt, or any other cryptographic library. The sole external dependency for the whole tool remains cryptsetup. Default cipher pool (all xts-plain64:512): aes-xts-plain64 serpent-xts-plain64 twofish-xts-plain64 Default hash pool: sha256, sha512, whirlpool, ripemd160 --multipass Independent passphrases per level group. abysscrypt mount --levels 10 --multipass 4,7 /dev/sdb /mnt/secret Prompts for three passphrases up-front: Group Levels Passphrase pg1 1 - 3 first prompt pg2 4- 6 second prompt pg3 7- 10 third prompt Each group passphrase is held in its own mlocked + MADV_WIPEONFORK page and wiped immediately after the last level in that group is opened. No passphrase is ever held in memory longer than necessary. Security implication: an attacker who obtains the passphrase for one group cannot derive keys for any other group. Combined with cipher-phrasing this gives each level an independent passphrase and an independent cipher/hash selection. No oracle anywhere in the stack. Plain dm-crypt has no header, no magic number, no checksum, no "this is the right key" signal. Grover's algorithm requires a function that returns true/false for "is this the right key?". With LUKS, that function is "did the header decrypt to a valid LUKS structure?" cheap and well-defined. With plain dm-crypt at the bottom of an N-layer stack, the function is "did this guess of every passphrase group, run through every layer in the right order with the right cipher/hash, produce a valid filesystem at the deepest level?" meaning every Grover iteration costs L full sector decryptions plus a filesystem-validity check, not one hash comparison. The constant factor becomes enormous, and the oracle itself depends on the layout see point 3. The "cipher phrasing" technique described in and implemented by this software using a secret passphrase to deterministically derive the per-layer cipher and hash assignment across a multi-layer plain dm-crypt encryption stack, such that the layout is never stored on disk, in any header, or in any configuration file, and is known only to the user at runtime is an original invention of hairetikos A.K.A. oroboroso@sdf.org GRANT OF RIGHTS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, merge, and distribute the Software for non-commercial purposes, subject to all of the following conditions. CONDITIONS 1. ATTRIBUTION MANDATORY IN ALL CASES All copies of the Software, modified versions, derivative works, or any software that incorporates, re-implements, or is substantially inspired by the cipher phrasing technique whether in source code, binary form, documentation, or any other medium must: a) Retain this copyright notice and license text in full. b) Display clear, prominent, and unambiguous credit to hairetikos as the original author of abysscrypt and the inventor of cipher phrasing. This credit must appear in the software's help output, documentation, README, about screen, or equivalent, wherever the software is described to end users. c) Include the following notice wherever cipher phrasing is described, referenced, or used, in any product documentation, academic paper, presentation, or derivative work: "Cipher phrasing is an original invention of hairetikos A.K.A. oroboroso@sdf.org. Reference implementation: https://github.com/hairetikos/abysscrypt" 2. SHARE-ALIKE FOR DERIVATIVES Any software that incorporates, adapts, ports, or re-implements the cipher phrasing technique, whether using this codebase or not, must be distributed under this license or a license with attribution and commercial-restriction terms at least as protective as those stated here. 3. NO MISREPRESENTATION OF INVENTION You may not represent the cipher phrasing technique as your own invention, claim inventorship of it or any substantially equivalent technique, file for any patent, registered design, trade secret protection, or other intellectual property right over it, or assist any third party in doing so. RESTRICTED USES WRITTEN PERMISSION REQUIRED The following uses are NOT permitted without prior written permission from hairetikos: a) COMMERCIAL USE incorporation into any software product that is sold, licensed for a fee, offered as a paid subscription, or bundled as a component of any product generating revenue, in whole or in part. b) ENTERPRISE USE deployment within any commercial organisation where the Software or the cipher phrasing technique is used to protect internal systems, data, infrastructure, or operations as part of a business activity, regardless of whether the Software itself is sold. c) GOVERNMENT AND INSTITUTIONAL USE use by, or deployment within, any governmental body, military organisation, intelligence agency, law-enforcement body, regulatory authority, or publicly funded institution, at any level (local, national, supranational), in any jurisdiction, for any purpose. d) HOSTED SERVICES incorporation into any software-as-a-service, platform-as-a-service, cloud-hosted product, or managed service offering where the cipher phrasing technique or the Software forms part of the service provided to third parties. To request permission for any restricted use, contact hairetikos via the repository at https://github.com/hairetikos/abysscrypt. PERMITTED WITHOUT RESTRICTION (BEYOND CONDITIONS ABOVE) The following uses are freely permitted subject to the attribution and share-alike conditions above: - Personal use by individuals for their own data protection - Non-commercial academic and security research - Educational use in courses, tutorials, and training materials - Evaluation, testing, and security auditing - Non-commercial open-source projects TERMINATION Any violation of the attribution requirements, the share-alike condition, the misrepresentation prohibition, or the restricted-use terms automatically and immediately terminates all rights granted under this license without notice. Upon termination you must cease all use and distribution of the Software and destroy all copies in your possession. DISCLAIMER THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.