<commit_before>package bithorde;

enum HashType
{
  SHA1 = 1;
  SHA256 = 2;
  TREE_TIGER = 3;
  ED2K = 4;
}

enum CipherType {
  CLEARTEXT = 0;    // Cleartext
  XOR = 1;          // Very fast, pure-obfuscation. Keeps nosy people out, but not secure at all.
  RC4 = 2;          // ArcFour. Quite fast, but has some security-weaknesses. See http://en.wikipedia.org/wiki/RC4 for details.
  AES_CTR = 3;      // Highly secure, but comparatively slow/cpu-intensive.
}

enum Status {
  NONE = 0;
  SUCCESS = 1;
  NOTFOUND = 2;
  INVALID_HANDLE = 3;
  WOULD_LOOP = 4;
  DISCONNECTED = 5;
  TIMEOUT = 6;
  NORESOURCES = 7;
  ERROR = 8;
}

message Identifier {
    required HashType type = 1;   // Name of the other side
    required bytes    id   = 2;   // Version of the protocol this client supports
}

message HandShake { // Must be first message in stream
  required string name = 1;
  required uint32 protoversion = 2 [default = 2];
  optional bytes challenge = 3;   // Set if sender requires authentication of other part.
}

/****************************************************************************************
 * A word on authentication and encryption.
 *
 *  Authentication works by each peer sending a challenge to other part, asking for
 *  proof that the other part has a copy of a secret pre-share key. The challenge is
 *  fulfilled by the other part answering the HMAC-Sha256 of the message-parts.
 *
 * The parts may also in the second stage decide to inform it's messages will be
 * encrypted. The cipher may be chosen by the sender from the Cipher-enumeration. To
 * enable encryption, the sender must also include a cipheriv/nonce in the
 * HandShakeConfirmation.
 *
 * The HandShake is finally confirmed and authenticated by HMAC[SHA256]-hashing:
 *   shared_key ~ recieved_challenge ~ cipher(as single byte-int) ~ cipheriv
 *
 * NOTE: There is currently no negotiation over supported Ciphers. Sender decides what
 *       cipher to use. The behavior if recipient cannot support that cipher is
 *       undefined.<commit_msg>[bithorde.proto]Fix a couple of broken comments.<commit_after>package bithorde;

enum HashType
{
  SHA1 = 1;
  SHA256 = 2;
  TREE_TIGER = 3;
  ED2K = 4;
}

enum CipherType {
  CLEARTEXT = 0;    // Cleartext
  XOR = 1;          // Very fast, pure-obfuscation. Keeps nosy people out, but not secure at all.
  RC4 = 2;          // ArcFour. Quite fast, but has some security-weaknesses. See http://en.wikipedia.org/wiki/RC4 for details.
  AES_CTR = 3;      // Highly secure, but comparatively slow/cpu-intensive.
}

enum Status {
  NONE = 0;
  SUCCESS = 1;
  NOTFOUND = 2;
  INVALID_HANDLE = 3;
  WOULD_LOOP = 4;
  DISCONNECTED = 5;
  TIMEOUT = 6;
  NORESOURCES = 7;
  ERROR = 8;
}

message Identifier {
    required HashType type = 1;   // Type of hashId
    required bytes    id   = 2;   // Raw Hash-Digest of type.
}

message HandShake { // Must be first message in stream
  required string name = 1;
  required uint32 protoversion = 2 [default = 2];
  optional bytes challenge = 3;   // Set if sender requires authentication of other part.
}

/****************************************************************************************
 * A word on authentication and encryption.
 *
 *  Authentication works by each peer sending a challenge to other part, asking for
 *  proof that the other part has a copy of a secret pre-share key. The challenge is
 *  fulfilled by the other part answering the HMAC-Sha256 of the message-parts.
 *
 * The parts may also in the second stage decide to inform it's messages will be
 * encrypted. The cipher may be chosen by the sender from the Cipher-enumeration. To
 * enable encryption, the sender must also include a cipheriv/nonce in the
 * HandShakeConfirmation.
 *
 * The HandShake is finally confirmed and authenticated by HMAC[SHA256]-hashing:
 *   shared_key ~ recieved_challenge ~ cipher(as single byte-int) ~ cipheriv
 *
 * NOTE: There is currently no negotiation over supported Ciphers. Sender decides what
 *       cipher to use. The behavior if recipient cannot support that cipher is
 *       undefined.
{'fraction_non_alphanumeric': 0.11537521388413591, 'fraction_numerical': 0.018577364947445614, 'mean_word_length': 3.1969230769230768, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3546607', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1185, 'n_words': 499}