# your code goes here """ base58 encoding / decoding functions """ import unittest alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' base_count = len(alphabet) def encode(num): """ Returns num in a base58-encoded string """ encode = '' if (num < 0): return '' while (num >= base_count): mod = num % base_count encode = alphabet[mod] + encode num = num / base_count if (num): encode = alphabet[num] + encode return encode def decode(s): """ Decodes the base58-encoded string s into an integer """ decoded = 0 multi = 1 s = s[::-1] for char in s: decoded += multi * alphabet.index(char) multi = multi * base_count return decoded class Base58Tests(unittest.TestCase): def test_alphabet_length(self): self.assertEqual(58, len(alphabet)) def test_encode_10002343_returns_Tgmc(self): result = encode(10002343) self.assertEqual('Tgmc', result) def test_decode_Tgmc_returns_10002343(self): decoded = decode('Tgmc') self.assertEqual(10002343, decoded) def test_encode_1000_returns_if(self): result = encode(1000) self.assertEqual('if', result) def test_decode_if_returns_1000(self): decoded = decode('if') self.assertEqual(1000, decoded) def test_encode_zero_returns_empty_string(self): self.assertEqual('', encode(0)) def test_encode_negative_number_returns_empty_string(self): self.assertEqual('', encode(-100)) if __name__ == '__main__': #print encode(int("00B94BA6C51B3D8372D82FDE5DC78773D960B5A82FCDAC8181",16)) print hex(decode("Wh4bh"))
SQLite format 3 @ . š ˜ # g ] tablesettingssettingsCREATE TABLE settings (name TEXT,value TEXT, PRIMARY KEY (name))/C indexsqlite_autoindex_settings_1settings 3Aindexk_latency_timestampeventsCREATE INDEX k_latency_timestamp ON events (latency DESC, persistence DESC, timestamp ASC)ZƒtableeventseventsCREATE TABLE events (record_id TEXT,tenant_token TEXT NOT NULL,latency INTEGER,persistence INTEGER,timestamp INTEGER,retry_count INTEGER DEFAULT 0,reserved_until INTEGER DEFAULT 0,payload BLOB) = ï = ‡/U! Œl86BC0416-B17F-4FB9-9864-886DBA04977D4bb4d6f7cafc4e9292f972dca2dcde42-bd019ee8-e59c-4b0f-a02c-84e72157a3ef-7485”Q†?¯)3.0I evt_statsq˜ê¼Ðé˜Ý©"o:4bb4d6f7cafc4e9292f972dca2dcde42Ë i Dell Inc.‰Latitude E6440 Ë Ë I&c:6b3dbb93-2833-4456-aea7-7ddfd8907c14©Windows.Desktop Ë ‰Windows Desktop©,10.0.19041.1.amd64fre.vb_release.191206-1406 Ë © OneDriveSetupÉ 24.232.1118.3É OneDriveSetup Ë I UnmeterediUnknown Ë )EVT-Windows-C++-No-3.4.276.7I$B1F7E2C3-67C8-456D-8AC6-EF9277530813q‰$0C5BBED2-6CD5-4874-A206-C268A961DC67 Ë! i-06:00 Ë% É< evt_statsËF - bytesi33156 evt_bytesi442682 evt_bytes_maxi8139 evt_bytes_mini588 evt_rcvi60 evt_snti6 freqi1800 kindistop ln_snti2 lr_snti4 off_typeiSQLite/Default pkg_acki7 pkg_drop_HTTP_403i1 pkg_drpi1 pkg_oki6 pkg_pndi7 rej_403i1 rtt_maxi639 rtt_mini73 sess_timei 1736534525144 snap_timei 1736534540207 stat_timei 1736534525186 †U! Š*8476071E-6397-4E04-BDEE-E6B0F3496C564bb4d6f7cafc4e9292f972dca2dcde42-bd019ee8-e59c-4b0f-a02c-84e72157a3ef-7485”Q†?¯)3.0I evt_statsq˜ê¼Ðé˜Ý©"o:4bb4d6f7cafc4e9292f972dca2dcde42Ë i Dell Inc.‰Latitude E6440 Ë Ë I&c:6b3dbb93-2833-4456-aea7-7ddfd8907c14©Windows.Desktop Ë ‰Windows Desktop©,10.0.19041.1.amd64fre.vb_release.191206-1406 Ë © OneDriveSetupÉ 24.232.1118.3É OneDriveSetup Ë I UnmeterediUnknown Ë )EVT-Windows-C++-No-3.4.276.7I$B1F7E2C3-67C8-456D-8AC6-EF9277530813q‰$0C5BBED2-6CD5-4874-A206-C268A961DC67 Ë! i-06:00 Ë% É< evt_statsËF - evt_bytesi816 evt_bytes_maxi816 evt_bytes_mini816 evt_rcvi1 freqi1800 kindistop off_typeiSQLite/Default sess_timei 1736534525144 snap_timei 1736534540207 stat_timei 1736534540207 ç ôç ”Q†?¯ ”Q†?¯