X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfcrypt.c;h=d673d386e7757cf739ffc35fbf35283476b39e3b;hb=f761a53231d1a023e2d3e5efcc5591b04a34f98a;hp=7e9ef8c16915ddb15f7a718516f0ca9cdd518730;hpb=335d0464d6ea90d5f30e6846e3142c287e0d582c;p=tfcrypt.git diff --git a/tfcrypt.c b/tfcrypt.c index 7e9ef8c..d673d38 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -2,7 +2,7 @@ * tfcrypt -- high security Threefish encryption tool. * * tfcrypt is copyrighted: - * Copyright (C) 2012-2018 Andrey Rys. All rights reserved. + * Copyright (C) 2012-2019 Andrey Rys. All rights reserved. * * tfcrypt is licensed to you under the terms of std. MIT/X11 license: * @@ -149,6 +149,29 @@ _baddfname: counter_opt = TFC_CTR_RAND; else if (!strcasecmp(optarg, "zero")) counter_opt = TFC_CTR_ZERO; + else if (strchr(optarg, ':')) { + char *ss, chr; + + counter_opt = TFC_CTR_SSET; + n = sizeof(ctr); + + s = d = optarg; t = NULL; + while ((s = strtok_r(d, ",", &t))) { + if (d) d = NULL; + + if (n == 0) break; + ss = strchr(s, ':'); + if (!ss) continue; + *ss = 0; ss++; + chr = (char)strtoul(s, &stoi, 16); + if (!str_empty(stoi)) continue; + x = (size_t)strtoul(ss, &stoi, 10); + if (!str_empty(stoi)) continue; + if (x > n) x = n; + memset(ctr+(sizeof(ctr)-n), (int)chr, x); + n -= x; + } + } else counter_file = sksum_hashlist_file = optarg; break; case 'C':