Giter Club home page Giter Club logo

horcrux's Introduction

horcrux

Split your file into encrypted horcruxes so that you don't need to remember a passcode

How it works

horcrux has two commands, split and bind.

Splitting

If I have a file called diary.txt in my current directory I can call

horcrux split diary.txt

and it will prompt me for how many horcruxes I want, and how many will be needed to resurrect the original file. For example I might want 5 horcruxes with the ability to resurrect the file if I have any 3. The horcrux files will be created like so:

diary_1_of_5.horcrux
diary_2_of_5.horcrux
...

Now you just need to disperse the horcruxes around the house on various USBs or online locations and hope you can recall where they all are!

Binding

To bind the horcruxes back into the original file just call

horcrux bind

in the directory containing the horcruxes (or pass the directory as an argument).

Installation

via homebrew:

brew install jesseduffield/horcrux/horcrux

via scoop:

scoop bucket add extras; scoop install horcrux

via binary release

Example to install the latest release on Linux to /usr/local/bin (needs jq):

curl https://api.github.com/repos/jesseduffield/horcrux/releases/latest | \
jq '.assets[] | select(.browser_download_url | endswith("_Linux_x86_64.tar.gz")) | .browser_download_url' | \
xargs curl -Lo /tmp/horcrux.tar.gz && \
tar xfz /tmp/horcrux.tar.gz -C /tmp && \
rm /tmp/horcrux.tar.gz && \
sudo mv /tmp/horcrux /usr/local/bin/horcrux

Who this is for:

  • People who need to encrypt a big sensitive file like a diary and don't expect to remember any passwords years from now (but who paradoxically will be capable of remembering where they've hidden their horcruxes)
  • People who want to transmit files across multiple channels to substantially reduce the ability for an attacker to intercept
  • People named Tom Riddle

FAQ

Q) This isn't really in line with how horcruxes work in the harry potter universe!

A) It's pretty close! You can't allow any one horcrux to be used to resurrect the original file (and why would you that would be useless) but you can allow two horcruxes to do it (so only off by one). Checkmate HP fans.

Q) How does this work?

A) This uses the Shamir Secret Sharing Scheme to break an encryption key into parts that can be recombined to create the original key, but only requiring a certain threshold to do so. I've adapted Hashicorp's implementation from their vault repo

Q) How is the key generated

A) Using the Go stdlib's crypto/rand Read function

You can help!

I don't have much time to work on Horcrux but I'm happy to review PRs. One issue you may want to tackle is #4 which relates to data integrity.

Alternatives

  • ssss. Works for keys but (as far as I know) not files themselves.
  • horcrux. Looks like somebody beat me to both the name and concept, however this repo doesn't support thresholds of horcruxes
  • Haystack. Implements another file sharding and reassembly algorithm inspired by SSSS, but requires a password for reassembly and does not support thresholds of horcruxes.

Plugs

Also check out my other projects:

horcrux's People

Contributors

7h3w1zz avatar ajariel avatar benjamin-lee avatar dawidd6 avatar henrysdev avatar jesseduffield avatar pbek avatar semistrict avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

horcrux's Issues

Proposal: Small GUI

Good day! Small sugestion:

It would be awesome to see smaaaal GUI for more comfortable and easy usage to spllit\join files :)

Just make small scatch what it can looks like...

P.S. I could help with translation to other languages and draw vector logo

Thanks for your work that already had been done!

2023-12-07_20-36

self-sufficient horcruxes

To guarantee the ability to recreate the original file from the horcruxes in the event that this repo would become lost there should be an option for the tool to return binary horcruxes that when executed run the horcrux program. Think like self extracting zip files in exe format.

So I can execute ./horcrux1 bind horcrux2 horcrux3 and recover the original file.

Cant Bind files, no such File or directory

[maus@lolcat bind]$ tree
.
├── folder
│   ├── split_1_of_3.horcrux
│   ├── split_2_of_3.horcrux
│   └── split_3_of_3.horcrux
└── horcrux

1 directory, 4 files
[maus@lolcat bind]$ ./horcrux bind folder/
2020/07/13 08:49:03 open split_1_of_3.horcrux: no such file or directory

How do I solve this Problem?
Thanks!

Number of required horcruxes differs between CLI and .horcrux files

If I run horcrux -t 3 -n 5 split diary.txt I get five .horcruxes, and each one contains

# THIS FILE IS A HORCRUX.
# IT IS ONE OF 5 HORCRUXES THAT EACH CONTAIN PART OF AN ORIGINAL FILE.
# THIS IS HORCRUX NUMBER 1.
# IN ORDER TO RESURRECT THIS ORIGINAL FILE YOU MUST FIND THE OTHER 4 HORCRUX(ES) AND THEN BIND THEM USING THE PROGRAM FOUND AT THE FOLLOWING URL
# https://github.com/jesseduffield/horcrux

-- HEADER --
[...]
-- BODY --
[...]

It says I must need this horcrux plus other four to resurrect the original file, while If I delete three horcruxes, ./horcrux bind . returns

You do not have all the required horcruxes. There are 3 required to resurrect the original file. You only have 2

saying that I need at least (only) three horcruxes

Is this a feature? ; )


EDIT: I also noticed a t>n error:

  • If I run .horcrux -n 5 split diary.txt and enter t=99 I get the following message. Should the interval be "[2-5]" instead of "(2-99)"?
How many horcruxes should be required to reconstitute the original file? If you require all horcruxes, the resulting files will take up less space, but it will feel less magical (2-99): 99
parts cannot be less than threshold
  • If I run .horcrux -t 5 split diary.txt and enter n=3 I get an error. Should the interval be "[5-inf]" instead of "(2-99)"?
How many horcruxes do you want to split this file into? (2-99): 3
parts cannot be less than threshold

Unrelated request, is it possible to add armv7h to the list of pre-released binaries?

How to get soul into file?

None of the examples explain how to get your soul into the computer so you can put it into the horcrux.

能否提供 darwin arm64 的版本

作者好,请问是否考虑在 release 中也提供适用 darwin arm64 的版本?

我们现在正开发 x-cmd,尝试以 portable 方式提供大量的二进制工具,比如x-cmd pkg | horcrux
在使用 horcrux 的过程中,我们发现 release 中缺少 darwin arm64 版本,一般我们希望以作者作为二进制可信源头,这样可以减少自行编译可能给用户带来的未知问题。

谢谢。

Great minds think alike

https://github.com/xkortex/passcrux

This town ain't big enough for two Harry-Potter-influenced Hashicorp-SSS-based data-splitting applications written in Golang...

So, wanna join forces?

:)

(Obviously, there's more than enough room in cyberspace, just was quoting the old spaghetti western trope :) )

Data Encryption - no Integrity

The project uses an un-verified secret sharing scheme for the key, which can be sufficient given an appropriate thread model. But it should be detectable if the either the data or the key has been tampered with (of course, replacing them altogether is still possible, but the problem of authenticity is not tackled at all in this project, which again is ok for this project).

However, unauthenticated OFB encryption is used (essentially a stream cipher), which allows for arbitrary bitwise flips of the plaintext and is undetectable by this library.

Countermeasures:

  1. Verify that the contents of each threshold file are actually the same
  2. Use ChaCha20-Poly1305 as an AEAD scheme, instead of OFB.

It's no issue at the moment, as each key is only used once, but please use a random IV as well.

Hashes

Hi mate,
It seems the hashes are different to the ones listed. I'm very new to Github and development.
Can you please upload the current hashes?
Apologies in advance if I haven't understood something about the process.
Cheers

Suggestion: Use reed-solomon encoding to reduce data size

The current implementation of the program appears to copy the encrypted file into each horcrux, which becomes pretty storage intensive with a larger file and more horcruxes.

n is the number of horcruxes, t the number needed to ressurect, s is size of the file, t ≤ n
Reed-solomon encoding can split the original file into n pieces, each piece has a size of s/t. Any combination of t pieces can be used to recreate the original file.

So the total space used by the horcruxes would be n*(s/t) instead of n*s.

This should also ensure the integrity of the data as the reconstruction of the file should fail if a piece is modified.

Option for XOR implementation

For users who want to require exactly N of N keys, XOR would be the safest, most performant, most reliable option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.