diff --git a/2021-07-07-Merklist.ipynb b/2021-07-07-Merklist.ipynb index 3709c9a..2c93011 100644 --- a/2021-07-07-Merklist.ipynb +++ b/2021-07-07-Merklist.ipynb @@ -2,10 +2,17 @@ "cells": [ { "cell_type": "markdown", - "id": "2bdec887-ee29-4bef-8978-88a81940f7bc", + "id": "83dd7287-bca5-49f9-b927-31bbc519d5b9", + "metadata": {}, + "source": [ + "# Merklist" + ] + }, + { + "cell_type": "markdown", + "id": "bf97974c-5582-4bf5-8ed8-6c43daf5036c", "metadata": {}, "source": [ - "# Merklist\n", "Using matrix multiplication's associativity and non-commutativity properties provides a natural definition of a cryptographic hash / digest / summary of an ordered list of elements. Due to the non-commutativity property, lists that only differ in element order result in a different summary. Due to the associativity property, arbitrarily divided adjacent sub-lists can be summarized independently and combined to quickly find the summary of their concatenation. This definition provides exactly the properties needed to define a list, and does not impose any unnecessary structure that could cause two equivalent lists to produce different summaries. The name *Merklist* is intended to be reminicent of other hash-based data structures like [Merkle Tree](https://en.wikipedia.org/wiki/Merkle_tree) and [Merklix Tree](https://www.deadalnix.me/2016/09/24/introducing-merklix-tree-as-an-unordered-merkle-tree-on-steroid/)." ] }, diff --git a/2021-XX-XX-Merklist-Field.ipynb b/2021-XX-XX-Merklist-Field.ipynb deleted file mode 100644 index 4d5a1a9..0000000 --- a/2021-XX-XX-Merklist-Field.ipynb +++ /dev/null @@ -1,115 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "acb06966-8cfa-4b28-9fa9-30286c33d20c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "203b80b6-7559-4861-ab9c-538885b8d223", - "metadata": { - "tags": [] - }, - "source": [ - "## Inverse?" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "66031921-f6b4-4c32-bc8b-97a92ea935df", - "metadata": { - "jupyter": { - "source_hidden": true - }, - "tags": [] - }, - "outputs": [], - "source": [ - "# Q: If you compute the inverse of one of these matrixes and multiply it to the right of the position\n", - "# where it was originally multiplied it should \"delete\" that element as if the element was never added.\n", - "# I'm uncertain of the possibility and frequency of such inverse matrices over finite fields.\n", - "# If this scenario is possible to construct, I think we should \"define\" this operation as deletion.\n", - "\n", - "# See: https://en.wikipedia.org/wiki/Determinant#Properties_of_the_determinant\n", - "\n", - "def det2(mat, m=256):\n", - " ((a, b),\n", - " (c, c)) = mat\n", - " return (a*c - b*c) % m\n", - "\n", - "def det3(mat, m=256):\n", - " ((a, b, c),\n", - " (d, e, f),\n", - " (g, h, i)) = mat\n", - " return (a*e*i + b*f*g + c*d*h - c*e*g - b*d*i - a*f*h) % m\n", - "\n", - "def det(mat, m=256):\n", - " # I dislike having to round here, but it returns a float\n", - " # I wish it returned a native \"B\" type\n", - " return int(round(np.linalg.det(mat),0)) % m\n", - "\n", - "a = ((-2,2,-3),(-1,1,3),(2,0,-1))\n", - "assert_equal(det(a), 18)\n", - "assert_equal(det(a), det3(a))\n", - "\n", - "# ?\n", - "# assert that they didn't change since the last time I ran it\n", - "assert_equal(det(f1), 128)\n", - "assert_equal(det(f2), 160)\n", - "assert_equal(det(f3), 128)" - ] - }, - { - "cell_type": "markdown", - "id": "568ad4ed-7894-465b-9bf3-f19f2269c0f3", - "metadata": { - "tags": [] - }, - "source": [ - "[This](https://math.stackexchange.com/questions/273054/how-to-find-matrix-inverse-over-finite-field) suggests to find the inverse matrix by first finding the adjugate then applying\n", - "\n", - "> (1/det(A))adj(A)=inv(A)\n", - "\n", - "Under mod p\n", - "\n", - "---\n", - "\n", - "The [adjugate](https://en.wikipedia.org/wiki/Adjugate_matrix) is the inverse of the cofactor matrix.\n", - "\n", - "---\n", - "\n", - "The cofactor matrix is made by multiplying the matrix minor of each (i,j) of the original matrix times a sign factor.\n", - "\n", - "---\n", - "\n", - "The (i,j)-minor of matrix A is the determinant of the matrix A with row i & column j removed." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.2" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/2021-XX-XX-Merklist-Tree.ipynb b/2021-XX-XX-Merklist-Tree.ipynb deleted file mode 100644 index 88447be..0000000 --- a/2021-XX-XX-Merklist-Tree.ipynb +++ /dev/null @@ -1,36 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "d6b5f16e-76a4-473f-a8cd-efd532f8673f", - "metadata": {}, - "source": [ - "# Merklist Tree\n", - "\n", - "Part 2 of the Merklist idea. Constructing a tree structure of summarized sublists, so that mutations to the list can be computed, verified, and stored using $O(log(N))$ time and space.\n", - "\n" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.2" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}