blob: 5a6dd155fe413995fb36d2fbff2ce6a04cea8496 [file] [log] [blame]

Supported Algorithms

') output.append('') output.append('
') for category in categories: if not category['name'].endswith('.Enabled'): output.append('
• ' '{name}
• '.format(**category)) output.append('
') for category in categories: if category['name'].endswith('.Enabled'): # These are handled in the "Supported" section below continue if category['name'] == 'Cipher': # We display ciphers in a four-column table to conserve space and # so that it's more comprehensible. To do this, we have to # collapse all our ciphers into "equivalence classes" of a sort. # First, collect the relevant data for each algorithm into a tuple. # The mode and padding are in lists because we are going to collapse # multiple tuples with those in later steps. algorithms = sort_by_name(category['algorithms']) tuples = [] for algorithm in algorithms: name, mode, padding = algorithm['name'].split('/') tuples.append(( name, [mode], [padding], algorithm['supported_api_levels'], 'deprecated' in algorithm and algorithm['deprecated'])) # Sort the tuples by all items except padding, then collapse # items with all non-padding values the same (which will always be # neighboring items) into a single item. tuples.sort(key=operator.itemgetter(0, 1, 3, 4)) i = 0 while i < len(tuples) - 1: if (tuples[i][0] == tuples[i+1][0] and tuples[i][1] == tuples[i+1][1] and tuples[i][3] == tuples[i+1][3] and tuples[i][4] == tuples[i+1][4]): tuples[i][2].extend(tuples[i+1][2]) del tuples[i+1] else: i += 1 # Do the same thing as above, but with modes. tuples.sort(key=operator.itemgetter(0, 2, 3, 4)) i = 0 while i < len(tuples) - 1: if (tuples[i][0] == tuples[i+1][0] and tuples[i][2] == tuples[i+1][2] and tuples[i][3] == tuples[i+1][3] and tuples[i][4] == tuples[i+1][4]): tuples[i][1].extend(tuples[i+1][1]) del tuples[i+1] else: i += 1 # Display the table with rowspans for those entries where all the # items have the same algorithm, mode, etc output.append('

{name}

'.format(**category)) output.append('') output.append('
') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append('
%s%s%s%s%s%s
') tuples.sort(key=operator.itemgetter(0, 4, 1, 2, 3)) i = 0 cur_deprecated = None cur_algorithm = None cur_mode = None while i < len(tuples): row = tuples[i] if row[4] != cur_deprecated: cur_deprecated = row[4] cur_algorithm = None cur_mode = None if cur_deprecated: output.append(' ') else: output.append(' ') if row[0] != cur_algorithm: cur_algorithm = row[0] cur_mode = None j = i + 1 while (j < len(tuples) and tuples[j][4] == cur_deprecated and tuples[j][0] == cur_algorithm): j += 1 rowspan = j - i if rowspan > 1: output.append(' ' % (rowspan, cur_algorithm)) else: output.append(' ' % cur_algorithm) if row[1] != cur_mode: cur_mode = row[1] j = i + 1 while (j < len(tuples) and tuples[j][4] == cur_deprecated and tuples[j][0] == cur_algorithm and tuples[j][1] == cur_mode): j += 1 rowspan = j - i modestring = '
'.join(cur_mode) if rowspan > 1: output.append(' ' % (rowspan, modestring)) else: output.append(' ' % modestring) output.append(' ' % '
'.join(row[2])) output.append(' ' % row[3]) output.append(' ') i += 1 output.append(' ') output.append('') elif category['name'].endswith('.Supported'): # Some categories come with a "Supported" and "Enabled" list, and we # group those together in one table for display. Every entry that's enabled # must be supported, so we can just look up the enabled version for each # supported item basename = category['name'][:-len('.Supported')] supported = sort_by_name(category['algorithms']) enabled = sort_by_name(find_by_name(categories, basename + '.Enabled')['algorithms']) output.append('

{0}

'.format(basename)) output.append('') output.append('
AlgorithmSupported API LevelsEnabled By Default
') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append('
{name}{supported_api_levels}{supported_api_levels}
') for algorithm in supported: if 'deprecated' in algorithm and algorithm['deprecated']: output.append(' ') else: output.append(' ') output.append(' '.format(**algorithm)) output.append(' '.format(**algorithm)) enabled_alg = find_by_name(enabled, algorithm['name']) if enabled_alg is None: output.append(' ') else: output.append(' '.format(**enabled_alg)) output.append(' ') output.append(' ') output.append('') else: output.append('

{name}

'.format(**category)) output.append('') output.append('
AlgorithmSupported API Levels
') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append(' ') output.append('
{name}{supported_api_levels}
') algorithms = sort_by_name(category['algorithms']) for algorithm in algorithms: if 'deprecated' in algorithm and algorithm['deprecated']: output.append(' ') else: output.append(' ') output.append(' '.format(**algorithm)) output.append(' '.format(**algorithm)) output.append(' ') output.append(' ') output.append('') if args.for_javadoc: for i in range(len(output)): output[i] = ' * ' + output[i] print '\n'.join(output) if __name__ == '__main__': main()