horcrux icon indicating copy to clipboard operation
horcrux copied to clipboard

Number of required horcruxes differs between CLI and .horcrux files

Open AlphaJack opened this issue 3 years ago • 4 comments

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?

AlphaJack avatar Aug 03 '20 08:08 AlphaJack

@AlphaJack the -t option is for the required minimum number of horcruxes to resurrect the original file and -n is how many horcruxes in total will be made.

horcrux-help

At the top of each file it shows how many other horcruxes in total there are, while the command tells you how many it needs (the threshold) to reconstruct the original file.

Note: the comment at the very top is just a user friendly message, if you look at the header you can find the important information.

I made a test file, with your parameters, and if you look at the header, you can see "total" which shows how many in total horcruxes there are and "threshold" which shows minimum required horcruxes to bind together to reconstruct the original file.

horcrux-header


EDIT: I also noticed a t>n error

Well, yeah, when t > n it will obviously break, you want to reconstruct the file from more horcruxes than there are!

Let's get your second example, with n = 3 and t = 5 (again, n is total number of horcruxes and t is minimum required to resurrect original file). You are splitting the file in 3 different horcruxes, but you want to be able to resurrect it with 5 different horcruxes.

  • 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

That obviously doesn't work! It even gives you the error parts cannot be less than threshold.

I don't understand what you mean by Should the interval be "[5-inf]" instead of "(2-99)"?. No, it shouldn't, why should it?


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

If you have an unrelated request, just make another issue for it.

Syndamia avatar Aug 30 '20 07:08 Syndamia

My suggestion about the header content is replace

IN ORDER TO RESURRECT THIS ORIGINAL FILE YOU MUST FIND THE OTHER $n-1 HORCRUX(ES)

with

IN ORDER TO RESURRECT THIS ORIGINAL FILE YOU MUST FIND AT LEAST OTHER $t-1 HORCRUX(ES)

Because with horcrux -t 3 -n 5 split diary.txt you don't need "this plus the other 4 horcruxes" ($n files required), you just need "this and other 2 horcruxes" ($t files required).


I don't understand what you mean by Should the interval be "[5-inf]" instead of "(2-99)"?. No, it shouldn't, why should it?

.horcrux -t 5 split diary.txt returns

How many horcruxes do you want to split this file into? (2-99):

This interval range is wrong because you can only enter a number equal or above 5 (not 2), so it should be (5-99) instead of (2-99)

I wrote "[5,inf]" because you can pick up a valid number higher than 99. The sqaure brackets state that range boundarys are valid choices, but round brackets are fine in this context.


If you have an unrelated request, just make another issue for it.

Nevermind.

AlphaJack avatar Sep 03 '20 14:09 AlphaJack

I'm sorry, I misunderstood your ideas the first time.

I agree with both of your suggestions.

Syndamia avatar Sep 04 '20 10:09 Syndamia

I misunderstood your ideas the first time.

No problem, I expressed myself badly in my original post, I'm glad it helped

AlphaJack avatar Sep 04 '20 10:09 AlphaJack