Wintertree Software Inc.

Sentry Spelling Checker Engine - Support

Home Site index Contact us Catalog Shopping Cart Products Support Search

You are here: Home > Support > Sentry Spelling Checker Engine > License key overflow


License key overflows

Product: Sentry Spelling Checker Engine Windows SDK

Problems:

  1. The programming language I use doesn't support hexadecimal constants. How can I convert the license key you provided to decimal?

  2. When I convert the license key you provided to decimal, my programming language reports that the key overflows, or is too large.

Solution:

To convert your license key to decimal:

The license key provided by Wintertree Software is expressed as a hexadecimal constant. The reason is the license key is an unsigned 32-bit integer, and most common programming languages (Visual Basic, C/C++/C#, Delphi) know to treat a hexadecimal constant as an unsigned integer. Some programming languages (e.g., PowerBuilder) do not support hexadecimal constants, so the license key provided by Wintertree Software must be converted to decimal.

The easiest way to do this is to use the Windows calculator utility in "scientific" mode. The calculator utility is found in the Accessories folder in the Start menu. To enable "scientific" mode, select View + Scientific. To convert your hexadecimal license key to decimal, follow these steps:

  1. Make sure the "Hex" radio button is selected. Note that a row of buttons labeled "A" - "F" near the numeric keypad in the calculator window becomes enabled.

  2. Enter your hexadecimal license key (e.g., 1234ABCD). Use the "A" - "F" buttons to enter any letters in your hexadecimal license key.

  3. Select the "Dec" radio button. Your license key in decimal (e.g., 305441741) appears in the calculator's display.

If your license key overflows:

The license key is an unsigned integer. Roughly speaking, this means it uses all 32 bits of a 32-bit integer. A signed 32-bit integer, on the other hand, uses one bit to represent the sign, and the other 31 bits to represent the value. The largest positive signed value that can be represented in a 32-bit integer is 2147483647 decimal (7FFFFFFF hexadecimal). A decimal value larger than this may cause an overflow. If your hexadecimal license key is 8 digits long and starts with 8, 9, or A-F, it will convert to a large unsigned decimal integer that may cause an overflow. If your hexadecimal license key is fewer than 8 digits long, or starts with 0-7, it will not cause an overflow when converted to decimal (provided it is stored or passed as a 32-bit integer and not a 16-bit integer).

If your programming language supports unsigned decimal constants, you can probably avoid the overflow by indicating that the license key is unsigned. For example, in languages derived from C, an unsigned constant is indicated with the suffix "U", so a large integer is indicated as unsigned like this: 2882343476U. Consult your programming language's documentation, or contact the people who support it, to enquire about unsigned decimal constants.

If your programming language does not support unsigned decimal constants, you can convert a large unsigned decimal integer to a signed, negative decimal integer by subtracting 4294967296. For example, suppose your license key is ABCD1234 hexadecimal:

This negative value (-1412623820) will not cause an overflow (provided it is stored or passed as a 32-bit integer and not a 16-bit integer). Make sure you include the minus sign!


Home Site index Contact us Catalog Shopping Cart Products Support Search


Copyright © 2015 Wintertree Software Inc.