Lines Matching full:output
85 def print_ssl_64(output, name, val):
95 - output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew)))
99 + output.write(u'static BN_ULONG {}[] = {{\n'.format(name))
104 - output.write('\t')
105 - output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4),…
106 + output.write(u'\t')
107 + output.write(u'0x{:016x}ULL, '.format(vword))
111 - output.write('\n')
112 + output.write(u'\n')
114 - output.write('\n')
115 - output.write('};\n\n')
116 + output.write(u'\n')
117 + output.write(u'};\n\n')
119 def print_ssl_32(output, name, val):
129 - output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew)))
133 + output.write(u'static BN_ULONG {}[] = {{\n'.format(name))
138 - output.write('\t')
139 - output.write('0x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4)))
140 + output.write(u'\t')
141 + output.write(u'0x{:08x}, '.format(vword))
145 - output.write('\n')
146 + output.write(u'\n')
148 - output.write('\n')
149 - output.write('};\n\n')
150 + output.write(u'\n')
151 + output.write(u'};\n\n')
153 def print_ssl(output, name, val):
155 + output.write(u'#include <stdint.h>\n')
156 + output.write(u'#include <openssl/bn.h>\n')
159 - output.write('#include <stdint.h>\n')
161 return print_ssl_64(output, name, val)
163 return print_ssl_32(output, name, val)
165 def print_ssl_keys(output, n):
166 - output.write(r'''
167 + output.write(u'''
186 - output.write(' KEYS(e_%d, n_%d),\n' % (n, n))
187 - output.write('};\n')
188 + output.write(u' KEYS(e_{0}, n_{0}),\n'.format(n))
189 + output.write(u'};\n')
192 def print_gcrypt(output, name, val):
193 - output.write('#include <stdint.h>\n')
196 - output.write('static const uint8_t %s[%d] = {\n' % (name, len(val)))
201 + output.write(u'#include <stdint.h>\n')
202 + output.write(u'static const uint8_t %s[%d] = {\n' % (name, len(vwords)))
207 - output.write('\t')
208 - output.write('0x%.2x, ' % ord(v))
209 + output.write(u'\t')
210 + output.write(u'0x{:02x}, '.format(vword))
214 - output.write('\n')
215 + output.write(u'\n')
217 - output.write('\n')
218 - output.write('};\n\n')
219 + output.write(u'\n')
220 + output.write(u'};\n\n')
222 def print_gcrypt_keys(output, n):
223 - output.write(r'''
224 + output.write(u'''
241 - output.write(' KEYS(e_%d, n_%d),\n' % (n, n))
242 - output.write('};\n')
245 + output.write(u' KEYS(e_{0}, n_{0}),\n'.format(n))
246 + output.write(u'};\n')
255 - print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))
256 + print('Usage: {} [{}] input-file... output-file'.format(sys.argv[0], '|'.join(modes.keys())))
259 -output = open(outfile, 'w')
260 +output = io.open(outfile, 'w')
270 - modes[mode][0](output, 'e_%d' % idx, key.e[4:])
271 - modes[mode][0](output, 'n_%d' % idx, key.n[4:])
275 + modes[mode][0](output, 'e_{}'.format(idx), key.e)
276 + modes[mode][0](output, 'n_{}'.format(idx), key.n)
280 modes[mode][1](output, idx - 1)