parameters: ()
return_statement: return jid
docstring: Return 'jid1-XYZ', where 'XYZ' is a randomly-generated string. (in the
      previous jid0- series, the string securely identified a specific public
      key). To get a suitable add-on ID, append '@jetpack' to this string.
docstring_summary: Return 'jid1-XYZ', where 'XYZ' is a randomly-generated string. (in the
      previous jid0- series, the string securely identified a specific public
      key). To get a suitable add-on ID, append '
docstring_tokens: Return jid1 - XYZ where XYZ is a randomly - generated string . ( in the previous jid0 - series the string securely identified a specific public key ) . To get a suitable add - on ID append
function: def create_jid():
      """Return 'jid1-XYZ', where 'XYZ' is a randomly-generated string. (in the
      previous jid0- series, the string securely identified a specific public
      key). To get a suitable add-on ID, append '@jetpack' to this string.
      """
      # per https://developer.mozilla.org/en/Install_Manifests#id all XPI id
      # values must either be in the form of a 128-bit GUID (crazy braces
      # and all) or in the form of an email address (crazy @ and all).
      # Firefox will refuse to install an add-on with an id that doesn't
      # match one of these forms. The actual regexp is at:
      # http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#130
      # So the JID needs an @-suffix, and the only legal punctuation is
      # "-._". So we start with a base64 encoding, and replace the
      # punctuation (+/) with letters (AB), losing a few bits of integrity.
  
      # even better: windows has a maximum path length limitation of 256
      # characters:
      #  http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
      # (unless all paths are prefixed with "\\?\", I kid you not). The
      # typical install will put add-on code in a directory like:
      # C:\Documents and Settings\<username>\Application Data\Mozilla\Firefox\Profiles\232353483.default\extensions\$JID\...
      # (which is 108 chars long without the $JID).
      # Then the unpacked XPI contains packaged resources like:
      #  resources/$JID-api-utils-lib/main.js   (35 chars plus the $JID)
      #
      # We create a random 80 bit string, base64 encode that (with
      # AB instead of +/ to be path-safe), then bundle it into
      # "jid1-XYZ@jetpack". This gives us 27 characters. The resulting
      # main.js will have a path length of 211 characters, leaving us 45
      # characters of margin.
      #
      # 80 bits is enough to generate one billion JIDs and still maintain lower
      # than a one-in-a-million chance of accidental collision. (1e9 JIDs is 30
      # bits, square for the "birthday-paradox" to get 60 bits, add 20 bits for
      # the one-in-a-million margin to get 80 bits)
  
      # if length were no issue, we'd prefer to use this:
      h = os.urandom(80/8)
      s = base64.b64encode(h, "AB").strip("=")
      jid = "jid1-" + s
      return jid
function_tokens: def create_jid ( ) : # per https://developer.mozilla.org/en/Install_Manifests#id all XPI id # values must either be in the form of a 128-bit GUID (crazy braces # and all) or in the form of an email address (crazy @ and all). # Firefox will refuse to install an add-on with an id that doesn't # match one of these forms. The actual regexp is at: # http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#130 # So the JID needs an @-suffix, and the only legal punctuation is # "-._". So we start with a base64 encoding, and replace the # punctuation (+/) with letters (AB), losing a few bits of integrity. # even better: windows has a maximum path length limitation of 256 # characters: #  http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx # (unless all paths are prefixed with "\\?\", I kid you not). The # typical install will put add-on code in a directory like: # C:\Documents and Settings\<username>\Application Data\Mozilla\Firefox\Profiles\232353483.default\extensions\$JID\... # (which is 108 chars long without the $JID). # Then the unpacked XPI contains packaged resources like: #  resources/$JID-api-utils-lib/main.js   (35 chars plus the $JID) # # We create a random 80 bit string, base64 encode that (with # AB instead of +/ to be path-safe), then bundle it into # "jid1-XYZ@jetpack". This gives us 27 characters. The resulting # main.js will have a path length of 211 characters, leaving us 45 # characters of margin. # # 80 bits is enough to generate one billion JIDs and still maintain lower # than a one-in-a-million chance of accidental collision. (1e9 JIDs is 30 # bits, square for the "birthday-paradox" to get 60 bits, add 20 bits for # the one-in-a-million margin to get 80 bits) # if length were no issue, we'd prefer to use this: h = os . urandom ( 80 / 8 ) s = base64 . b64encode ( h , "AB" ) . strip ( "=" ) jid = "jid1-" + s return jid