<s> import base64 <EOL> from native_tags . decorators import function , filter <EOL> from hashlib import sha1 <EOL> def codectag ( encoding , codec = True ) : <EOL> codec = '<STR_LIT>' % ( encoding , codec and '<STR_LIT>' or '<STR_LIT>' ) <EOL> def inner ( s , * args , ** kwargs ) : <EOL> return getattr ( base64 , codec ) ( s , * args , ** kwargs ) <EOL> inner . __name__ = codec <EOL> inner . __doc__ = getattr ( base64 , codec ) . __doc__ + """<STR_LIT>""" % codec <EOL> return filter ( function ( inner ) ) <EOL> enc , dec = '<STR_LIT:1>' , '<STR_LIT>' <EOL> b16encode = codectag ( <NUM_LIT:16> ) <EOL> b16encode . test = { '<STR_LIT:args>' : ( enc , ) , '<STR_LIT:result>' : dec } <EOL> b16decode = codectag ( <NUM_LIT:16> , False ) <EOL> b16decode . test = { '<STR_LIT:args>' : ( dec , ) , '<STR_LIT:result>' : enc } <EOL> enc , dec = '<STR_LIT:z>' , '<STR_LIT>' <EOL> b32encode = codectag ( <NUM_LIT:32> ) <EOL> b32encode . test = { '<STR_LIT:args>' : ( enc , ) , '<STR_LIT:result>' : dec } <EOL> b32decode = codectag ( <NUM_LIT:32> , False ) <EOL> b32decode . test = { '<STR_LIT:args>' : ( dec , ) , '<STR_LIT:result>' : enc } <EOL> enc , dec = '<STR_LIT:z>' , '<STR_LIT>' <EOL> b64encode = codectag ( <NUM_LIT:64> ) <EOL> b64encode . test = { '<STR_LIT:args>' : ( enc , ) , '<STR_LIT:result>' : dec } <EOL> b64decode = codectag ( <NUM_LIT:64> , False ) <EOL> b64decode . test = { '<STR_LIT:args>' : ( dec , ) , '<STR_LIT:result>' : enc } </s>
