allow selecting hash

This commit is contained in:
Zack Scholl 2021-06-21 07:34:28 -07:00
parent 646c879edc
commit ecf3eb872e
2 changed files with 3 additions and 3 deletions

View File

@ -55,6 +55,7 @@ func Run() (err error) {
ArgsUsage: "[filename]",
Flags: []cli.Flag{
&cli.StringFlag{Name: "code", Aliases: []string{"c"}, Usage: "codephrase used to connect to relay"},
&cli.StringFlag{Name: "hash", Value: "xxhash", Usage: "hash algorithm (xxhash, imohash, md5)"},
&cli.StringFlag{Name: "text", Aliases: []string{"t"}, Usage: "send some text"},
&cli.BoolFlag{Name: "no-local", Usage: "disable local relay when sending"},
&cli.BoolFlag{Name: "no-multi", Usage: "disable multiplexing"},
@ -199,7 +200,7 @@ func send(c *cli.Context) (err error) {
NoCompress: c.Bool("no-compress"),
Overwrite: c.Bool("overwrite"),
Curve: c.String("curve"),
HashAlgorithm: "xxhash",
HashAlgorithm: c.String("hash"),
}
if crocOptions.RelayAddress != models.DEFAULT_RELAY {
crocOptions.RelayAddress6 = ""
@ -408,7 +409,6 @@ func receive(c *cli.Context) (err error) {
IP: c.String("ip"),
Overwrite: c.Bool("overwrite"),
Curve: c.String("curve"),
HashAlgorithm: "xxhash",
}
if crocOptions.RelayAddress != models.DEFAULT_RELAY {
crocOptions.RelayAddress6 = ""

View File

@ -776,7 +776,7 @@ func (c *Client) processMessageFileInfo(m message.Message) (done bool, err error
c.Options.NoCompress = senderInfo.NoCompress
c.Options.HashAlgorithm = senderInfo.HashAlgorithm
if c.Options.HashAlgorithm == "" {
c.Options.HashAlgorithm = "imohash"
c.Options.HashAlgorithm = "xxhash"
}
log.Debugf("using hash algorithm: %s", c.Options.HashAlgorithm)
if c.Options.NoCompress {