How does the sqlcipher exectue the sqlite3_rekey()?

Use the original key decrypt all encrypted_data to plain_text, then encrypt the plain_text with the new key and store?

Hello @ellipse, the rekey operation operates on sections of the database, called pages, one at a time, while inside a transaction. Each page is decrypted using the old key into memory, then encrypted with the new key and written to storage. The decrypted content is never written to disk.

Hello @ellipse

In addition to what @sjlombardo detailed above, if you are interested in the actual implementation, please feel free to read the code that execute the operation here.