International phone number max and min? [duplicate] - standards

This question already has answers here:
What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone
(6 answers)
What is the minimum length of a valid international phone number?
(3 answers)
Closed 10 months ago.
What is the max and min digits for an international telephone number?
(country code + area code + phone number)

, where the format of telephone
numbers is standardized by ITU-T in
the recommendation E.164, which
specifies that the entire number
should be 15 digits or shorter,
Source: http://en.wikipedia.org/wiki/Telephone_number
Also, check this other question on SO:
What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone

Telephone numbers are standardised by ITU-T in their recommendation E.164. In the recommendation they say telephone numbers should not exceed 15 digits.
So it's up to the telephone operators and local standards.
Most operators don't allow you to send SMS messages to numbers which are more than 16 digits long. So you'll be safe with 16 digit limit.
Edit A nice summary of misconceptions about phonenumbers can be read at https://github.com/googlei18n/libphonenumber/blob/master/FALSEHOODS.md

The answer to that question can (and does) change in a fashion which is entirely too fluid to be able to provide you with a definitive answer. Carriers or countries can change their numbering plans (adding area codes or adding digits or the like) at any time.
A website which I often use as a reference for International Phone Numbers is http://www.numberingplans.com/
I believe they also sell their databases, if you are wanting to validate individual numbers within your own system..

15 digits is maximum, refer this link
https://en.wikipedia.org/wiki/E.164

Although the standard is talking about 15 digits maximum, a call number extension using Direct Inward Dial (DID) and Private Branch Exchange (PBX) technologies is oftenly used in order to call a specific person or department inside an organisation, which can make a phone number longer than 15 digits (note "-1234" suffix at the end):
0049 (30) 123456789-1234
In our systems we use the limit of 20 digits.

Actually, the question asks for an "international" phone number but mentions an area code which some nations don't have. In E.164 the national part was found be no more than 12 digits at the time of writing. Then they added a country code and atleast a "+" for the prefix.
Longer subscriber numbers may be possible however and we know that they do get assigned in some regions of the world. The technical limitation for that can be found in the 3GPP standards (like GSM) and ISDN standards (like DSS1) which have 10 bcd-encoded bytes for the subscriber number - plus a byte for the prefix which can be up to 4 digits to be dialled. That adds up to a limit of 24 digits for a viable subscriber number.

Related

BTLE characteristic value has too many bytes [duplicate]

This question already has an answer here:
Decode bluetooth data from the Indoor Bike Data characteristic
(1 answer)
Closed 2 years ago.
I'm trying to read data from the BTLE fitness machine service, specifically the Indoor Bike Data characteristic.
A typical reading I'm getting has the bytes 44-02-9c-09-5c-00-4f-00-50. The first two are flags which indicate that the rest of the bytes represent, in order:
Instantaneous cadence (uint16)
Instantaneous power (sint16)
Heart rate (uint8)
The trouble is, that only accounts for 5 more bytes, but there are 7 more bytes in the value. It looks like 5c-00 is cadence, 00-4f is power, and 50 is heart rate, but
I don't know what the 9c-09 represents, but more importantly,
I don't know how to reliably read this characteristic if it's going to send me data that the flags field says is not present.
What do I need to do to parse these bytes correctly? In this specific case I could maybe skip those two bytes, but that won't be reliable over different device manufacturers.
Update: FWIW I don't think it was correct to mark this as a duplicate. I was able to parse the bytes, the problem was that the result appeared to contradict the fitness machine spec. The accepted answer clarified that.
The 9c-09 value is instantaneous speed, which is present (counterintuitively) if the first flag bit is 0. See Fitness Machine Service spec, section 4.9.1.1.

Maximum Size for a phone number extension? [duplicate]

This question already has answers here:
What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone
(6 answers)
Closed 10 months ago.
Im trying to make a phone number extension field but Im not sure what the maximum amount of digits it can have and I dont see any sources online.
I was asking the same question myself but I couldn't find anything conclusive. I did, however, find a couple of useful bits of information that helped me come to a decision.
Robert Pepper at GetVoIP, says:
In an older PBX, that would be four digits, and limited to the same building. In a hosted PBX, it can be three, four or five digits, and the extension can be anywhere in the world, including your cell phone.
But, GoToConnect's website states:
An extension is a three to six-digit number identifying a specific call path configuration that allows you to dial and connect to another caller internally.
With that in mind, I decided to use six digits as a max length, until I learn otherwise.
Generally E.164 formatting using on apps.On this format max length is 15 this but using '+' for countrycode.
if you use Instead of '+' '00' it will be max 16 .

Point of checkdigits in MRZs?

Not sure if this is the right subreddit to ask this question, but I will give it a shot. There is the ICAO standard for Machine Readable Zones as described here https://en.wikipedia.org/wiki/Machine-readable_passport. I don't see the point for check digits there.
If I have F instead of 5 for example in the MRZ code somewhere in the second line for example, all the checkdigits will be the same. What is the point in the first place for those check digits in the ICAO standard? Especially I don't see the point of the last check digits calculation since you could also calculate it by using the check digits from the second line and not all the letters/numbers.
Could someone explain why we need those checkdigits?
To be fair. This is not a subreddit. Anyway, there are multiple reasons that there are check digits inside the MRZ. The first reason is that automatic readers can check if the code is read well enough. The second reason is that it prevents a lot of fraud and identification theft. Some people that alter their travel documents do not know that there are check digits in place. So some people will get caught because they fail to edit the numbers.
Some countries now include PDF417 barcodes and/or QR-codes to reach better reads by machines. But keep in mind that not all governments/countries have access to high-tech devices, so the machine readable zone is still mandatory for a check with the naked eye.
Source: I work for a travel document verification company.
MRZ check digits are calculated on subsections of the entire MRZ. Each calculation serves as a check for each section. A final check digit is calculated on the sum of each sections and this digit serves as a double check of the individual check.
The below have same check digit of 8:
123456780
128456785
Whereas the subsection check digit matched after the tampering but the final check digit will detect this. Therefore, the final check digit adds additional robustness.
Although, I am wondering whether this visual check digit is mandatory because an eMRTD NFC chip BAC protocol also does a much stronger cryptographic check of the MRZ value.
UPDATES: My original claim that the composite check digit adds robustness to tampering is incorrect. Given the below TD1 MRZ:
IDSLV0012345678<<<<<<<<<<<<<<<
9306026F2708252SLV<<<<<<<<<<<4
JOHN<SMEAGOL<<WENDY<LIESSETTEF
An OCR scanner can either gave 0012345678 or OO12345678 for the document number portion and all check digits passes including the composite check digit. But there is no way to tell which document number is correct. It seems that an MRZ check digit has edge cases that cannot be helped.

256-bit encryption with small random alphanumeric password

We are considering using email to transmit PDFs containing personal health-related information ("PHI"). There is nothing of commercial value, no social security numbers or credit card numbers, or anything like that in these documents. Only recommendations for treatment of medical conditions.
The PDFs would be password-encrypted using Adobe Acrobat Pro's 256-bit password encryption.
Using very long passwords is not logistically desirable because the recipient of the emails with PDF attachment is the patient, not a technical person. We want to make the password easy-to-type, and yet not so short that any desktop PC has the CPU capacity to crack it in a few minutes.
If a password does not use any dictionary words but is simply a four-character random ASCII alphanumeric string, like DT4K (alphas all uppercase, not mixed), how long would it take a typical desktop business or home computer with no specialized hardware to crack the encryption? Does going to 5 characters significantly increase the cracking time?
Short answer: no, and no.
Longer answer: alphanumeric means A-Za-z0-9, right? That's 62 possible characters, or 5.95 bits of entropy. Since entropy is additive, 4 characters are roughly 24 bits, and 5 are about 30. To put that into comparison, 10 bits mean the attacker has to try about a thousand possible keys, 20 bits are a million, 30 bits about a billion. That's almost nothing these days. 56 bit DES was cracked using brute force in 1998, today people worry that 128 bit AES might not be safe enough.
If i were you, I'd try to use something like diceware. That's a list of 7776 easily pronounced words. You can use a random number generator to pick a passphrase from these words, and each word will have about 12.9 bits of entropy. So 5 words are about 65 bits, which for the kind of data you have might be an acceptable level of security, while being easily remembered or communicated via phone.
Why 7776 words? Well, 7776 is 6*6*6*6*6, so you can roll a die five times and get a number, and just look up the corresponding word on the list.
My bank sends statements encrypted and uses a combination of my name and birth date. I'm not a huge fan of that idea, but provided you use information that's unlikely to be known to an attacker you'll get a greater level of security than from four or five character alphanumeric passwords.
This would take less than an 25 seconds even with the most rudimentary tools. There are precomplied rainbow tables for passwords this short that can run in seconds on decent PC's. Password length, NOT complexity, are what make a password difficult to crack. I would highly recomend giving them a longer password, but make it something eaisly recalled. Maybe you entire business name salted with your street address number at the end. Please take at least some precautions. Having a four character password is barely better than not having one at all.
How Strong is your Password?

How can I create my own GUID algorithm with smaller "global"?

I have my own application with far more smaller "global" than our real global and I wanted shorter version of GUID. Now supposed I have my concrete number of IDs that I estimated to not ever exceed (for example 100 million IDs). How can I determine the number of random bits required to have the same property as GUID? (Globally unique, require no central authority to generate one) Using the normal GUID would be an overkill.
My "overkill" refers to this : I need the ID to be as easily typed/say/write down as possible and have somewhat astronomically low collision chance as GUID at the same time. I heard GUID can be assigned to every grain of sand on earth. My application is a game, each player get one ID generated, obviously my players is not as much as the amount of sand on earth.
It would be the best if player can say like "My ID is XXXX-XXXX". In that case, I would be not so sure if 8 characters of randomized hex is not enough or too much for 100 million players. (In reality I encode it to A-Z 0-9 instead of hex though) My game is not online restricted, so I would like each player to be able to obtain unique ID even when not online. (no server to check ID collisions)
GUID has been designed to be globally unique. But I don't know why that results in 128-bit sequence. Maybe they just choose the "very large" one that is a power of 2? I don't know what are they thinking when designing GUID to ensure that it will not clash. (They use world population times something? If that is the case I can too use 10 million times something.)
A 128-bit guid will generally perform well, because most compilers are smart enough to reduce operations on it to a pair of 64-bit operations (and on some CPUs, a single 128-bit extended operation). Java and C#/VB.NET would likely have quite a bit more overhead than C++, but if you are using Java or C#/VB.NET, you've already accepted quite a bit more overhead, and a GUID won't add much to it.
However, if you really need smaller values, you could manually reduce GUIDs, by XOR-ing the upper 64 bits with the lower 64 bits (thereby preserving some of the uniqueness of the original) to create a compact 64-bit mostly-unique number.
You could reduce to 32-bit or 48-bit in a similar way, always a multiple of the size of the original GUID. This has the advantage that you are starting out with a number that is intended to be unique across a very large set. However, keep in mind that 100 million items require a fairly high number of bits to preserve a non-overlapping guarantee, so you may just be setting yourself up for a very difficult-to-find problem later on if you aren't careful.
A crude but probably equally effective approach is to use a cryptographically-secure random number generator and construct a number as large as you need (probably minimum 48-bit). It is important not to do modulo operations on the results, or you could significantly reduce the uniqueness (due to the period of the random number generator).
I am assuming you cannot use a sequential id, although you may want to revisit that idea and see if there is a way to make a sequential id work. For example, you could use a sequential id paired with a random seed number, guaranteeing uniqueness without requiring a large number, and allowing internal indexing operations and similar optimizations that are common with large data sets.
Ok, I have discussed with friend and came up with solution. This is how to decide the number of "characters" of my game ID.
A character would consist of 0-9 and A-Z instead of HEX, thats 36 kinds of characters. We took out 0 O 1 I so it would be printable to variety of fonts without confusion, that leaves 32 kind of characters.
Then if every characters will be pseudo-randomized, how many players can we safely have?
We used Birthday paradox's square approximation. The formula in that page indicate how many number of people necessary to have 50% chance of 2 people colliding. It is 22.99 people for birthday problem. (365 possible choices)
Now we substitute 32^No.of characters into the equation instead of 365. This is how many players that will cause 50% chance of 2 players having the same ID :
Finally, we agreed to choose 9-character ID so the game can be registered up to 6.9 million players before just 2 from all 6.9 million players will have the same ID (50% chance).
The game isn't even online-only! It only collide if that 2 players is still actively playing at the same time and decide to send score to the scoreboard in the same week because of weekly score reset. So the actual number that the game can hold would be somewhat higher than that. (The game will probably not having that many players.. it is just a small happy dream of every game startups. Well at least the computation was fun.)
It will probably looks like this for easier reading : 5XT-339-A67

Resources