I have a technical question.
A wallet is protected by a password, which encrypts the key.
Is it possible to "merge" two encrypted wallets into one and have a completely new database, if they are encrypted with the same password?
Is there any paper on how the encryption works?
Two different encrypted wallets will be encrypted using two different keys, even if they have the same password. As you mentioned yourself, the
key is encrypted using the password. Accordingly the wallet itself is not encrypted using the password but the randomly generated key that is encrypted using said password.
Bitcoin Core's wallet.dat uses standard ciphers and hashing algorithms. See here for reference:
https://en.bitcoin.it/wiki/Wallet_encryptionInformation on AES-256 and SHA-512 itself is widely available. It is not possible to "merge" AES-256 encrypted data without decrypting it first, even if they are encrypted using the same key.