NAME

piclock - lock a directory, a file or bytes with pictures and a handful of clicks

SYNOPSIS

piclock lock Accounts --image harbour.jpg
piclock unlock Accounts.plock --image harbour.jpg

piclock lock notes.txt --image harbour.jpg --image cat.png --bake
piclock unlock notes.txt.plock

echo 'the code is 4812' | piclock lock - --to code.plock --image harbour.jpg
piclock unlock code.plock --to - --image harbour.jpg

piclock lock   PATH [--to FILE] --image IMG [clicks] [passphrase] [--bake]
                    [--radius PX] [--memory MIB] [--passes N] [--remove]
piclock lock   -     --to FILE  --image IMG [clicks] [passphrase] [--bake] ...
piclock unlock FILE [--to PATH] [--image IMG] [clicks] [passphrase]
piclock verify FILE             [--image IMG] [clicks] [passphrase]
                    [--portable]
piclock list   FILE             [--image IMG] [clicks] [passphrase]
piclock rekey  FILE             [--image IMG] [clicks] [passphrase]
                    [--new-image IMG] [--new-clicks[=X,Y:X,Y:...]]
                    [--bake | --no-bake]
                    [--new-passphrase | --new-passphrase-fd N | --no-passphrase]
                    [--radius PX] [--memory MIB] [--passes N]
piclock pictures FILE [--to DIR]
piclock info   FILE
piclock calibrate [--seconds N] [--passes N] [--most MIB]
piclock --help | --version

DESCRIPTION

A directory and everything in it becomes one file, which opens with a picture and an ordered handful of clicks on it. This is Picture::Lock from a command line. What a locked file keeps and does not keep, what each step proves before the next, and what a picture and clicks are worth as a secret, are all said there.

What is locked may also be one file, or whatever comes from standard input. What opens it may be up to eight pictures in an order, each with clicks of its own. And the pictures may be put inside the locked file, which then opens with clicks alone.

The picture is its bytes. Keep the file that was used, exactly as it is. The same picture saved again, resized or stripped of its metadata is another picture, and it is the first that opens the file. The command says so at every lock.

WHAT IT DOES

lock PATH

Locks the directory into PATH.plock, or into the file --to names. The file is written beside its name, read back whole with the same picture and clicks, and only then given its name. With --remove the directory is taken away afterwards, each thing in it only if it is byte for byte what the locked file holds.

PATH may be one file, and the command looks to see which it is. A file is locked with its bytes, its permission bits and its time. Its name is not kept, and --remove is not for it.

lock -

Locks what comes from standard input, at most 64 MiB of it, into the file --to names. The clicks are then not read from standard input: they are given with --clicks or asked for by the picker.

pg_dump accounts | piclock lock - --to accounts.plock --image harbour.jpg
unlock FILE

Unlocks the file into what it holds: FILE with its .plock taken off, or the name --to gives. A file that holds a directory makes a directory, one that holds a file makes a file, and bytes make a file that is its owner's alone. --to - writes bytes to standard output and nothing else there.

piclock unlock accounts.plock --to - --image harbour.jpg | psql accounts

A time in the file that this system's clock cannot hold is set to the nearest it can. The command says so on standard error, and still ends with 0.

verify FILE

Reads the file whole and writes nothing.

With --portable it also says what in the file another system would not take as it is, a line for each after the line that says the file is sound: two names that are one where capital and small letters are not told apart, a name that Windows cannot hold, a link, a time that a clock of 32 bits has not. It then ends with status 3. "verify" in Picture::Lock has the word that begins each line.

list FILE

What the file holds, a line an entry in the order of the tree: d, f or l for a directory, a file or a link, the permission bits, the size, when it was last modified, and the path. The directory itself is . and a link has -> and its target after it. A byte of a path that is a control character or a backslash is written \xHH.

A file that holds one file is one line, an f with . for its name. One that holds bytes is one line, a b, with dashes where bytes have no permission bits and no time.

rekey FILE

Changes what opens the file and leaves its contents alone. --new-image is another picture, --new-clicks other clicks, and what is not named anew stays as it was, the passphrase too. --no-passphrase takes the passphrase off. New clicks are joined to their option, as --new-clicks=X,Y:X,Y:..., and --new-clicks with nothing joined to it asks the picker for them.

A rekey changes the copy it is given. A copy of the file that was made before it still opens with what opened it then.

--new-image may be given several times, for a file that is to take several pictures, and --new-clicks=... then once for each. --bake puts the pictures inside the file and --no-bake takes them out again. A directory locked with one picture that stays outside is rekeyed where it stands, and takes the same time whatever its size. Every other rekey makes a new file beside the old, reads it back, and gives it the old file's name in one step.

pictures FILE

Writes the pictures a file has inside it into the directory --to names, or the one it is run in, as picture-1.png, picture-2.jpg and so on, each with the ending of what it is. It takes no picture and no clicks, since the pictures are not secret. It writes over nothing, and where one of the names is taken it writes none of them.

info FILE

What the file says to anyone, with no picture and no clicks: what it holds, how many pictures it takes, how many clicks and what radius each has, and whether they are inside it.

calibrate

Tries this machine and changes nothing. It finds the memory at which one try at opening a file takes about --seconds, which is 1 unless it is given, and prints that cost, the options that set it, and what the default takes here.

$ piclock calibrate
881 MiB and 3 passes: one try at opening a file takes 0.93 seconds here.
  --memory 881 --passes 3
The default is 256 MiB and 3 passes, which takes 0.30 seconds here.
A file locked at a cost asks it of every machine that opens it. Choose for the slowest that will.

That was an Apple M5. Its tries are made in one process, and a command that opens a file touches its memory for the first time: at that cost it took 1.05 seconds there.

It asks for no more memory than --most, in MiB, nor for more than half of what the system says is free, and it says so where one of those stopped it short of the time asked. --passes is the passes the file will have. It takes about five times the seconds asked.

A locked file asks its cost of every machine that opens it. Run this on the slowest machine that will open the file, and lock with what it says there.

Nothing that is there is ever written over, by any of them.

PICTURES

--image is given once for each picture, up to eight, in the order they are to be asked for again. One picture alone takes 4 to 16 clicks. One of several takes 1 to 16, and all of them together 4 or more. Every picture and every click goes into one key: a wrong picture and a wrong click, first or last, fail the same way and after the same work, and nothing says which it was. The file says how many pictures it takes and how many clicks on each. Which picture goes where is yours to remember.

piclock lock Accounts --image harbour.jpg --image cat.png --image map.webp

--bake puts the pictures inside the locked file. It then takes no --image, and piclock unlock FILE is the whole command.

A picture inside the file can be seen by anyone who has the file, with piclock pictures, and its clicks are what keep it shut. The command says so at every such lock. With its pictures inside and no passphrase a file takes 8 clicks or more, and asks for 1 GiB of memory unless --memory says otherwise. A picture that goes inside is at most 32 MiB, and all of them 64 MiB together.

CLICKS

A click is a pixel of the picture as it is stored: x counted from its left edge and y from its top, both from 0. They come from the first of these that there is.

--clicks X,Y:X,Y:...

On the command line, once for each picture and in their order. Where a file is opened it may be given once with the clicks of every picture one after another, and the file, which says how many each takes, deals them out. An argument stays in the shell's history, and anyone on the machine can see it in the list of what is running. It is there for scripts and for tests, and the command says so when it is used at a terminal.

--pick

The picker, whatever standard input is.

standard input

When it is not a terminal: one X,Y a line, and a line with nothing on it between the clicks of two pictures.

piclock unlock Accounts.plock --image harbour.jpg < clicks
the picker

When standard input is a terminal. The picture is shown in the terminal, as a picture where the terminal can show one and in characters where it cannot, and is clicked with the mouse or with the keys: see Picture::Lock::Picker. The first press brings the place pressed closer and the second is the click. At a lock the clicks are asked for twice. Where there are several pictures each is shown in turn, and at a lock each in turn and then each again, so that the order is rehearsed with the places. A file that has its pictures inside shows its own. --marks draws a mark where each click fell, which helps the hand: it is for a screen that nobody else can see. --zoom looks closer still at the first press: 2, 4 or 8 times.

Clicks that are not written that way are refused before anything else is done.

A PASSPHRASE

--passphrase asks for one at the terminal and shows nothing of what is typed. At a lock it asks twice. --passphrase-fd N reads one line from an open descriptor:

piclock lock Accounts --image harbour.jpg --passphrase-fd 3 3< phrase

A passphrase is 1 to 1024 bytes and is used exactly as given. It is never taken from an argument. With one, the picture, the clicks and the passphrase are all needed to open the file.

WHAT A GUESS COSTS

--memory, in MiB, and --passes are the cost of each try at opening the file: 256 MiB and 3 unless they are given. --radius is how many pixels off a later click may be, and is chosen from the picture's size unless it is given. piclock calibrate says what a cost takes on the machine it is run on. "What a lock costs" in Picture::Lock has the rest.

EXIT STATUS

0

Done.

1

What was offered does not open the file: the wrong picture, the wrong clicks or the right ones in the wrong order, the wrong passphrase, or one where none is expected. So are another number of pictures than the file takes, and a picture given to a file that has its own.

2

The file is damaged, or is not a locked file, or was made by a later version.

3

Refused, and nothing was made: a name that is taken, a directory that holds what cannot be kept, clicks that cannot be enrolled, a picture that cannot be read or cannot go inside, a file or a directory asked for on standard output, a picker that was left before the clicks were made. And verify --portable of a file that holds something another system would not take.

4

Usage: the command line or the form of the clicks is wrong, or there is no way here to ask for clicks.

5

The machine: a file could not be read or written, memory could not be had, or there were no random bytes.

A script can tell a wrong secret, which is 1, from a broken backup, which is 2.

ENVIRONMENT

PICLOCK_PICTURES and NO_COLOR change how the picker draws. Both are in "ENVIRONMENT" in Picture::Lock::Picker.

SEE ALSO

Picture::Lock, Picture::Lock::CLI, Picture::Lock::Picker, Picture::Lock::Format

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)