+ @classmethod
+ def create(cls, file, c, h, m, tag):
+ """
+ Create and initialize a new, empty, database FILE.
+
+ We want a GCipher subclass C, a GHash subclass H, and a GMAC subclass M;
+ and a Pixie passphrase TAG.
+
+ This doesn't return a working object: it just creates the database file
+ and gets out of the way.
+ """
+
+ ## Set up the cryptography.
+ pp = _C.ppread(tag, _C.PMODE_VERIFY)
+ ppk = PPK(pp, c, h, m)
+ ck = _C.rand.block(c.keysz.default)
+ mk = _C.rand.block(c.keysz.default)
+ k = Crypto(c, h, m, ck, mk)
+
+ ## Set up and initialize the database.
+ db = _G.open(file, 'n', 0600)
+ db['tag'] = tag
+ db['salt'] = ppk.salt
+ db['cipher'] = c.name
+ db['hash'] = h.name
+ db['mac'] = m.name
+ db['key'] = ppk.encrypt(_wrapstr(ck) + _wrapstr(mk))
+ db['magic'] = k.encrypt(_C.rand.block(h.hashsz))
+