Class BTPeerIDByteDecoderUtils

java.lang.Object
com.biglybt.core.peermanager.utils.BTPeerIDByteDecoderUtils

class BTPeerIDByteDecoderUtils extends Object
  • Constructor Details

    • BTPeerIDByteDecoderUtils

      BTPeerIDByteDecoderUtils()
  • Method Details

    • decodeMnemonic

      public static String decodeMnemonic(char c)
    • decodeNumericValueOfByte

      public static String decodeNumericValueOfByte(byte b)
    • decodeNumericValueOfByte

      public static String decodeNumericValueOfByte(byte b, int min_digits)
    • decodeNumericChar

      public static String decodeNumericChar(char c)
    • intchar

      public static String intchar(char c)
    • decodeAlphaNumericChar

      public static String decodeAlphaNumericChar(char c)
    • isAzStyle

      public static boolean isAzStyle(String peer_id)
    • isShadowStyle

      public static boolean isShadowStyle(String peer_id)
      Checking whether a peer ID is Shadow style or not is a bit tricky. The BitTornado peer ID convention code is explained here: http://forums.degreez.net/viewtopic.php?t=7070 The main thing we are interested in is the first six characters. Although the other characters are base64 characters, there's no guarantee that other clients which follow that style will follow that convention (though the fact that some of these clients use BitTornado in the core does blur the lines a bit between what is "style" and what is just common across clients). So if we base it on the version number information, there's another problem - there isn't the use of absolute delimiters (no fixed dash character, for example). There are various things we can do to determine how likely the peer ID is to be of that style, but for now, I'll keep it to a relatively simple check. We'll assume that no client uses the fifth version digit, so we'll expect a dash. We'll also assume that no client has reached version 10 yet, so we expect the first two characters to be "letter,digit". We've seen some clients which don't appear to contain any version information, so we need to allow for that.
    • isMainlineStyle

      public static boolean isMainlineStyle(String peer_id)
    • isPossibleSpoofClient

      public static boolean isPossibleSpoofClient(String peer_id)
    • getMainlineStyleVersionNumber

      public static String getMainlineStyleVersionNumber(String peer_id)
    • getShadowStyleVersionNumber

      public static String getShadowStyleVersionNumber(String peer_id)
    • decodeAzStyleVersionNumber

      public static String decodeAzStyleVersionNumber(String version_data, String version_scheme)
    • getTwoByteThreePartVersion

      public static String getTwoByteThreePartVersion(byte b1, byte b2)
    • extractReadableVersionSubstringFromPeerID

      public static String extractReadableVersionSubstringFromPeerID(String peer_id)
      Look at the peer ID and just grab as many readable characters to form the version substring as possible.
    • decodeCustomVersionNumber

      public static String decodeCustomVersionNumber(String version_data, String version_scheme)
    • join

      private static String join(String a, String b)
    • joinAsDotted

      private static String joinAsDotted(String a, String b)
    • joinAsDotted

      private static String joinAsDotted(String a, String b, String c)