12
シャミールの秘密の共有
与えられたn(プレイヤーの数)、 t(しきい値)、およびs(秘密)、出力nによって生成された秘密シャミール秘密分散アルゴリズム。 アルゴリズム このチャレンジの目的のために、計算はGF(251)(sizeの有限体251、または整数mod 251として知られる)で行われます。通常、フィールドは、サイズがより大きい素数になるように選択されnます。課題を簡素化するために、フィールドサイズは一定になります。251これは、8ビットの符号なし整数で表現できる最大の素数であるため選択されました。 t-1(包括的)範囲でランダムな整数を生成します[0, 250]。これらのラベル1を通過T-1 。 構築t-1用い番目の多項式をsのパワーの係数として工程1からの一定値とランダムな整数としてx:F(X)= S + X * 1 + X 2 * 2 + ... + X T- 1 * a t-1。 (包括的)範囲内の(f(z) mod 251)それぞれの出力。z[1, n] 参照実装 #!/usr/bin/env python from __future__ import print_function import random import sys # Shamir's Secret Sharing algorithm # Input …
17
code-golf
number-theory
random
cryptography
polynomials
code-golf
number
code-golf
math
number
sequence
code-golf
quine
code-generation
code-golf
arithmetic
set-theory
code-golf
sequence
code-golf
code-golf
string
math
fastest-code
optimization
code-golf
code-golf
internet
stack-exchange-api
code-golf
array-manipulation
code-golf
string
internet
string
code-challenge
internet
test-battery
code-golf
math
pi
code-golf
arithmetic
primes
code-golf
array-manipulation
code-golf
string
code-golf
string
palindrome
code-golf
sequence
number-theory
fastest-algorithm
code-golf
math
number
base-conversion
code-golf
number-theory
sorting
subsequence
search
code-golf
permutations
code-challenge
popularity-contest
code-generation