diff --git a/BSP.markdown b/BSP.markdown index 976e38a..d707b59 100644 --- a/BSP.markdown +++ b/BSP.markdown @@ -6,25 +6,24 @@ Each channel on the local peer belongs to an application. The application decide ### Notation -We use || to denote concatenation, double quotes to denote an ASCII string, int(x) to denote x represented as a 64-bit integer, and len(x) to denote the length of x in bytes, represented as a 32-bit integer. All integers in BSP are big-endian. +We use || to denote concatenation, double quotes to denote an ASCII string, and len(x) to denote the length of x in bytes, represented as a 32-bit integer. All integers in BSP are big-endian. ### Crypto primitives -BSP uses a cryptographic hash function, H(m), with an output length of HASH_LEN bytes, and a random number generator, R(n), with an output length of n bytes. R(n) may be a true random number generator or a cryptographically secure pseudo-random number generator. We use H(m) to define a multi-argument hash function: +BSP uses a cryptographic hash function, H(m), with an output length of HASH_LEN bytes, and a random number generator, R(n), with an output length of n bytes. R(n) must be either a true random number generator or a cryptographically secure pseudo-random number generator. We use H(m) to define a multi-argument hash function: * `HASH(x_1, ..., x_n) == H(len(x_1) || x_1 || ... || len(x_n) || x_n)` - ### Channel identifiers -Each channel has a unique identifier HASH_LEN bytes long. This identifier is supplied by the application and is not interpreted by BSP. However, to prevent collisions between applications, BSP specifies how channel identifiers may be generated. The channel identifier may be random: +Each channel has a unique identifier HASH_LEN bytes long. This identifier is supplied by the application and is not interpreted by BSP, but to prevent collisions between applications, BSP specifies how channel identifiers may be generated. The channel identifier may be random: * `channel_id = R(HASH_LEN)` Alternatively, the channel identifier may be the hash of a random application identifier HASH_LEN bytes long and an application data structure describing the channel: * `app_id = R(HASH_LEN)` -* `channel_id = HASH(app_id, app_data_structure)` +* `channel_id = HASH("CHANNEL_ID", app_id, app_data_structure)` Including the application identifier in the hash prevents collisions between applications with similar data structures.