曾与蒿藜同雨露,한때 잡초와 쑥과 함께 비와 이슬을 나누던 곳이 이제는 소나무와 삼나무와 함께 서리와 눈을 견뎌내고 있다.终随松柏到冰霜.かつては雑草やヨモギと共に雨や露を分かち合っていたが、今では松やヒノキと共に霜や雪に耐えている。曾与蒿藜同雨露,Once sharing rain and dew with weeds and wormwood, now enduring frost and snow with pines and cypresses.终随松柏到冰霜.曾与蒿藜同雨露한때 잡초와 쑥과 함께 비와 이슬을 나누던 곳이 이제는 소나무와 삼나무와 함께 서리와 눈을 견뎌내고 있다.,终随松柏到冰霜.譖セ荳手珍阯懷酔髮ィ髴イ�檎サ磯囂譚セ譟丞芦蜀ー髴�曾与蒿藜同雨露,鏇句笌钂胯棞鍚岄洦闇诧紝缁堥殢鏉炬煆鍒板啺闇�终随松柏到冰霜.曾与蒿藜同雨露,한때 잡초와 쑥과 함께 비와 이슬을 나누던 곳이 이제는 소나무와 삼나무와 함께 서리와 눈을 견뎌내고 있다.终随松柏到冰霜.曾与蒿藜同雨露,终随松柏到冰霜.
"""
Test suite to check compilance with PEP 247, the standard API
for hashing algorithms
"""
import warnings
warnings.filterwarnings('ignore', 'the md5 module is deprecated.*',
DeprecationWarning)
warnings.filterwarnings('ignore', 'the sha module is deprecated.*',
DeprecationWarning)
import hmac
import md5
import sha
import unittest
from test import test_support
class Pep247Test(unittest.TestCase):
def check_module(self, module, key=None):
self.assertTrue(hasattr(module, 'digest_size'))
self.assertTrue(module.digest_size is None or module.digest_size > 0)
if not key is None:
obj1 = module.new(key)
obj2 = module.new(key, 'string')
h1 = module.new(key, 'string').digest()
obj3 = module.new(key)
obj3.update('string')
h2 = obj3.digest()
else:
obj1 = module.new()
obj2 = module.new('string')
h1 = module.new('string').digest()
obj3 = module.new()
obj3.update('string')
h2 = obj3.digest()
self.assertEqual(h1, h2)
self.assertTrue(hasattr(obj1, 'digest_size'))
if not module.digest_size is None:
self.assertEqual(obj1.digest_size, module.digest_size)
self.assertEqual(obj1.digest_size, len(h1))
obj1.update('string')
obj_copy = obj1.copy()
self.assertEqual(obj1.digest(), obj_copy.digest())
self.assertEqual(obj1.hexdigest(), obj_copy.hexdigest())
digest, hexdigest = obj1.digest(), obj1.hexdigest()
hd2 = ""
for byte in digest:
hd2 += '%02x' % ord(byte)
self.assertEqual(hd2, hexdigest)
def test_md5(self):
self.check_module(md5)
def test_sha(self):
self.check_module(sha)
def test_hmac(self):
self.check_module(hmac, key='abc')
def test_main():
test_support.run_unittest(Pep247Test)
if __name__ == '__main__':
test_main()