Skip to content

Instantly share code, notes, and snippets.

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFXR2AEBEACih5OBDSZ/Hv28DRluMfGY0qU1PtB0jYX8TYvxK4f9uYpo/V9N
DyXZNk7GFG7WKLa8xIEh8P5pNlOQDDS/u1xaA7BXs+82T9IJBvLjtyyBGj3zswoD
+RMTtzifNL0UFve58zL4jnXYsnCCN6t26/JbP7HIF6i/e3vR6jtXLewhIIf8T8TZ
e0rMA4HY0/3ePQ0K6W0VlbWJyZqzWHeCwQaNMqqnM/js5jme9x/zW3O3cEJNshRj
h64sOMgVmLqVfplWMt7Ia6nogUx4AF/6XzrPjJsyUmWPQ62s7/oO4onyFiG0Z4qX
tQ7x6iD6EvtBKISDt32hKyvJaj8cNYSDpLDDkA7fsblsNpn349CsbUx/Eben5bPW
iSdjA3/SvavpGstZl1rMQFcEaPbECtvfRSnYbqB0zoeUnIS81g5g+JXjawYm/QXj
QGKcUfo+qK6mPnQkioo1i2LUjsY8Ycuz3KkCQQfoTcl48sgpTJOL7Li9d+me5A5Z
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFXR1a4BEADNXlFM+L4lVb0El+KWMzVuZIkWCF9gVkUY3WMly49iI8zVKMj2
faWG4udo8NiWisT9KnELdkLqHjo29L1xRItKcNV7moftEyKlW0oaJMIb0AsA8t+D
JfwFOJS0+vhPLeLIWXY42p/CpKlgb2OTvMk3RRI15HlnkS+LO94XMqOx+ep2NcVO
w4hcLJiFH8ApWrg2FSADohlo34p5xSDXuA8pTbxGr7gjAaBD9tjJs2npzrmxWUdu
OiZXmjP5XilgJKzWdTEkB5A+h5WnVU1ends5WVid7/GWj/tEqbz0zkWuuBbSZc4M
Ez59kgh7ImA2h5YJyHpyTsuklUMu0N/JyHJnxd5DW7u9xQOCsri9vVLTEISufami
+/oHqkfKR3uuqKBZB6QJyKyYLJMb4t7zpcC7dZO/8xfs83iBlqVxaH1I5lMp4Po0
hTmyEv7oad1DDR6zwworjBOsY0CX0rt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V1Ut4OkUxkHENJJfzVuC3dq/
lX27tLuftuJRyWWXRzvQ6/VVjngnW9FEt5ClPpV0Bz7eHWxWTkVvotIwfh7tKyO/
81wEfJg81YmIwc8Nuqb+lo206pEyAmGl4C8kMUCJDv/hv3qCDeeRYcWceaPP2THx
alPuJ07RsJiz8LbAXsGwG1KOmVBjah/bwJNXguwVYciWdREV9ktqHYimlMdhnkhB
Zt5GaBZijOmXUmuq1PE6qPGSezeVpN5ZM9Iar3g7SWmhBy/7uEPiyDHoRROpDKJn
C07LzY60enxPc7kHzVxhTKf3L9b0Mhpq5T/TWhnnQ5Mn1oHAeh3by8jCK4rV0HA1
6X2vcPaQx0B7FpbS4ZZtFJKH6mN+WPFBauW6KsUAmxsdrRWrsFBbt6jUTnVDrHl8
qP0Scfels/zlWwtVDD7KW47lVBTJdUIqobbiD0FOyy0RSB4zCfNruftieYlWDRJO

ftp://ftp.inf.ethz.ch/pub/crypto/publications/Maurer11.pdf

#1 Overview 筆者らはConstructive cryptgraphyと呼ばれる新しい暗号スキームを提案した。

#2 Contribution 数学的な暗号の定義と分割することで、暗号の実現したい機能などが明確になる。

/* Encode (X,Y) using the EdDSA scheme. MINLEN is the required length
in bytes for the result. If WITH_PREFIX is set the returned buffer
is prefixed with a 0x40 byte. On success 0 is returned and a
malloced buffer with the encoded point is stored at R_BUFFER; the
length of this buffer is stored at R_BUFLEN. */
static gpg_err_code_t
eddsa_encode_x_y (gcry_mpi_t x, gcry_mpi_t y, unsigned int minlen,
int with_prefix,
unsigned char **r_buffer, unsigned int *r_buflen)
{
struct gcry_mpi
{
int alloced; /* Array size (# of allocated limbs). */
int nlimbs; /* Number of valid limbs. */
int sign; /* Indicates a negative number and is also used
for opaque MPIs to store the length. */
unsigned int flags; /* Bit 0: Array to be allocated in secure memory space.*/
/* Bit 2: The limb is a pointer to some m_alloced data.*/
/* Bit 4: Immutable MPI - the MPI may not be modified. */
/* Bit 5: Constant MPI - the MPI will not be freed. */
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>