<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo" -->

---
title: Enscryerypt: Encrypt and decrypt files with Scryer Prolog
description: A walkthrough of Enscryerypt, a tool built on Scryer Prolog for encrypting and decrypting files, including binary data like PDFs. It demonstrates encrypting...
canonical: https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Enscryerypt: Encrypt and decrypt files with Scryer Prolog | daily.dev
og:description: A walkthrough of Enscryerypt, a tool built on Scryer Prolog for encrypting and decrypting files, including binary data like PDFs. It demonstrates encrypting...
og:url: https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo
og:image: https://api.daily.dev/og/posts/s2i57YmxO.png
og:image:alt: Enscryerypt: Encrypt and decrypt files with Scryer Prolog
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Enscryerypt: Encrypt and decrypt files with Scryer Prolog

**[The Power of Prolog](https://daily.dev/sources/prolog_power)** · 9 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of Enscryerypt, a tool built on Scryer Prolog for encrypting and decrypting files, including binary data like PDFs. It demonstrates encrypting buffers and files with a password, explains the encrypted format (cost, tag, salt, base64 ciphertext), and shows an Emacs-based front end with secure buffer handling (quitting erases sensitive buffers, doc-view uses a canvas feature to avoid temp files). The underlying Prolog DCG implementation uses ChaCha20-Poly1305 authenticated encryption with a slow key-derivation function from the password and salt. The piece closes with a broader argument about the need for encryption to protect banking credentials, health data, professional secrets, and journalistic sources, especially against authoritarian regimes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=60kHy3vDvU8>

## Questions this post answers

### How does Enscryerypt encrypt files in Scryer Prolog?

Enscryerypt derives a key and nonce from a password and a randomly generated salt using an intentionally slow hashing algorithm to resist brute-force attacks, then encrypts the data with ChaCha20 combined with the Poly1305 authenticator for authenticated encryption. The output includes the cost factor, an authentication tag, the salt, and the ciphertext encoded in base64.

_Developers building password-based encryption tooling can compare implementation approaches like this on daily.dev._

### Can Scryer Prolog handle binary data like zero bytes correctly?

Yes, the latest version of Scryer Prolog correctly handles zero bytes in strings and buffers, which are common in binary files such as PDFs but rare in text files. This makes it possible to reliably encrypt and decrypt binary file content, not just plain text, using escape sequences to represent embedded zero bytes.

_Prolog developers tracking binary-data handling improvements can follow related updates on daily.dev._

### How can I prevent a password from being logged in Scryer Prolog's command history?

Start Scryer Prolog from the command line with the --no-add-history flag, which prevents the query, and therefore any password passed as an argument, from being written to the top-level history file. The password will still appear on screen and in the buffer, so using an Emacs front end avoids even that exposure.

_Developers hardening secrets handling in CLI tools can dig into similar practices on daily.dev._

## Similar posts on daily.dev

- [Search encrypted data with Prisma 8 and CipherStash](https://daily.dev/posts/search-encrypted-data-with-prisma-8-and-cipherstash-zxv5oz78e) · Prisma Blog · 0 upvotes · 0 comments
- [illarion/lockenv: Simple, password-based encrypted vault for .env and infrastructure secrets. Like git-crypt or sops, but dramatically simpler. Ideal for small teams and IaC workflows](https://daily.dev/posts/illarion-lockenv-simple-password-based-encrypted-vault-for-env-and-infrastructure-secrets-like-g-qeoqlehko) · Hacker News · 2 upvotes · 0 comments
- [Privacy Notes: Markdown Editor With Built-in Encrypted Vault](https://daily.dev/posts/privacy-notes-markdown-editor-with-built-in-encrypted-vault-xv6z9tndc) · It's Foss · 0 upvotes · 0 comments
- [Schneier on Security](https://daily.dev/posts/schneier-on-security-btivfoc3r) · Schneier on Security · 0 upvotes · 0 comments
- [DotBGE: Local-first file encryption for iOS, CLI, and agents](https://daily.dev/posts/dotbge-local-first-file-encryption-for-ios-cli-and-agents-6onquabrq) · Product Hunt · 1 upvotes · 1 comments

---

Tags: [#encryption](https://daily.dev/tags/encryption)

[View this post on daily.dev](https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Enscryerypt: Encrypt and decrypt files with Scryer Prolog","url":"https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo"},"datePublished":"2026-09-20T20:16:51.357Z","dateModified":"2026-09-20T20:17:11.485Z","description":"A walkthrough of Enscryerypt, a tool built on Scryer Prolog for encrypting and decrypting files, including binary data like PDFs. It demonstrates encrypting...","image":"https://i.ytimg.com/vi/60kHy3vDvU8/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/60kHy3vDvU8/sddefault.jpg","isAccessibleForFree":true,"articleSection":"The Power of Prolog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"The Power of Prolog","logo":"https://media.daily.dev/image/upload/s--Tzs1qCyp--/f_auto/v1728807697/logos/prolog_power","url":"https://daily.dev/sources/prolog_power"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"encryption","timeRequired":"PT9M","video":{"@type":"VideoObject","name":"Enscryerypt: Encrypt and decrypt files with Scryer Prolog","description":"A walkthrough of Enscryerypt, a tool built on Scryer Prolog for encrypting and decrypting files, including binary data like PDFs. It demonstrates encrypting...","thumbnailUrl":"https://i.ytimg.com/vi/60kHy3vDvU8/sddefault.jpg","uploadDate":"2026-09-20T20:16:51.357Z","duration":"PT9M","url":"https://api.daily.dev/r/s2i57YmxO","embedUrl":"https://www.youtube.com/embed/60kHy3vDvU8"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"The Power of Prolog","item":"https://daily.dev/sources/prolog_power"},{"@type":"ListItem","position":3,"name":"Enscryerypt: Encrypt and decrypt files with Scryer Prolog"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/enscryerypt-encrypt-and-decrypt-files-with-scryer-prolog-s2i57ymxo#faq","mainEntity":[{"@type":"Question","name":"How does Enscryerypt encrypt files in Scryer Prolog?","acceptedAnswer":{"@type":"Answer","text":"Enscryerypt derives a key and nonce from a password and a randomly generated salt using an intentionally slow hashing algorithm to resist brute-force attacks, then encrypts the data with ChaCha20 combined with the Poly1305 authenticator for authenticated encryption. The output includes the cost factor, an authentication tag, the salt, and the ciphertext encoded in base64. Developers building password-based encryption tooling can compare implementation approaches like this on daily.dev."}},{"@type":"Question","name":"Can Scryer Prolog handle binary data like zero bytes correctly?","acceptedAnswer":{"@type":"Answer","text":"Yes, the latest version of Scryer Prolog correctly handles zero bytes in strings and buffers, which are common in binary files such as PDFs but rare in text files. This makes it possible to reliably encrypt and decrypt binary file content, not just plain text, using escape sequences to represent embedded zero bytes. Prolog developers tracking binary-data handling improvements can follow related updates on daily.dev."}},{"@type":"Question","name":"How can I prevent a password from being logged in Scryer Prolog's command history?","acceptedAnswer":{"@type":"Answer","text":"Start Scryer Prolog from the command line with the --no-add-history flag, which prevents the query, and therefore any password passed as an argument, from being written to the top-level history file. The password will still appear on screen and in the buffer, so using an Emacs front end avoids even that exposure. Developers hardening secrets handling in CLI tools can dig into similar practices on daily.dev."}}]}
```

