CernVM-FS  2.13.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmd_hash.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_PUBLISH_CMD_HASH_H_
6 #define CVMFS_PUBLISH_CMD_HASH_H_
7 
8 #include <string>
9 
10 #include "publish/command.h"
11 
12 namespace publish {
13 
14 class CmdHash : public Command {
15  public:
16  virtual std::string GetName() const { return "hash"; }
17  virtual std::string GetBrief() const { return "CernVM-FS hash functions"; }
18  virtual std::string GetDescription() const {
19  return "Hash over a string or STDIN with one of the hash functions in "
20  "CernVM-FS";
21  }
22  virtual ParameterList GetParams() const {
23  ParameterList p;
24  p.push_back(
25  Parameter::Mandatory("algorithm", 'a', "algorithm name",
26  "hash algorithm to use (e.g. shake128, sha1)"));
27  p.push_back(Parameter::Optional("input", 'i', "string",
28  "data to hash over (instead of STDIN)"));
29  p.push_back(Parameter::Switch("fingerprint", 'f',
30  "print in fingerprint representation"));
31  p.push_back(Parameter::Switch(
32  "split", 's', "additionally print the hash as 64bit integer tuples"));
33  return p;
34  }
35  virtual bool IsHidden() const { return true; }
36 
37  virtual int Main(const Options &options);
38 };
39 
40 } // namespace publish
41 
42 #endif // CVMFS_PUBLISH_CMD_HASH_H_
virtual bool IsHidden() const
Definition: cmd_hash.h:35
static Parameter Optional(const std::string &key, char short_key, const std::string &arg_name, const std::string &desc)
Definition: command.h:69
static Parameter Switch(const std::string &key, char short_key, const std::string &desc)
Definition: command.h:74
virtual std::string GetName() const
Definition: cmd_hash.h:16
static Parameter Mandatory(const std::string &key, char short_key, const std::string &arg_name, const std::string &desc)
Definition: command.h:64
virtual std::string GetBrief() const
Definition: cmd_hash.h:17
std::vector< Parameter > ParameterList
Definition: command.h:86
virtual ParameterList GetParams() const
Definition: cmd_hash.h:22
virtual int Main(const Options &options)
Definition: cmd_hash.cc:22
virtual std::string GetDescription() const
Definition: cmd_hash.h:18