def test_fountain(): """ 测试喷泉吗的简单demo, 从文件中读取数据作为喷泉吗编解码使用的数据""" glass_id = 233 m = open(os.path.join(DOC_PATH, FOUNTAIN_TEXT), 'r').read() my_fountain = Fountain(m) my_glass = Glass(my_fountain.num_chunks) while my_glass.getString() != m: # fillAmt(my_fountain, my_glass, 10) # my_glass.addDroplet(my_fountain.droplet()) a_drop = my_glass.droplet_from_Bytes(my_fountain.droplet().toBytes()) my_glass.addDroplet(a_drop) sleep(2) # print 'add 10 drop' print('+++++++++++++++++++++++++++++') print(my_glass.getString()) print('done')
def fountain_builder(self): if self.fountain_type == 'normal': return Fountain(self.m, chunk_size=self.fountain_chunk_size, seed=self.seed) elif self.fountain_type == 'ew': return EW_Fountain(self.m, chunk_size=self.fountain_chunk_size, w1_size=self.w1_p, w1_pro=self.w1_pro, seed=self.seed)
def fountain_builder(self): if self.fountain_type == 'normal': self.m = open('./fountain.txt', 'r').read().encode() return Fountain(self.m, chunk_size=self.fountain_chunk_size, seed=self.seed) elif self.fountain_type == 'ew': return EW_Fountain(self.m, chunk_size=self.fountain_chunk_size, w1_size=self.w1_p, w1_pro=self.w1_pro, seed=self.seed)
def fountain_builder(self): if self.fountain_type == 'normal': return Fountain(self.m, chunk_size=self.fountain_chunk_size) elif self.fountain_type == 'ew': return EW_Fountain(self.m, chunk_size=self.fountain_chunk_size)