1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

1.FHEよりも高速な秘匿計算を創りたい:基盤技術と脆弱性

Last updated at Posted at 2025-12-23
  1. 現在、完全同型暗号(FHE)の実用化における最大の壁は、膨大な計算コストである。本記事では、宇宙際タイヒミュラー理論(IUT理論)の「宇宙を分離し、リンクを介して復元する」という設計思想に着想を得て、通常の整数演算に近いスループットで動作する秘匿計算の簡易アルゴリズムを提案する。

  2. アルゴリズム概要本手法は、数値を単一の空間で扱わず、以下のプロセスを経て演算を行う。宇宙際射出:入力値を基底ベクトル
    $(\cos \theta, \sin \theta)$
    を用いてAlpha宇宙とBeta宇宙へ射出する。宇宙際演算:射出先の空間において、データの構造を秘匿したまま加法および乗法を適用する。リンク復元 (Link Restoration):テータ・リンクに相当する内積演算およびノルム正規化により、演算結果を元の整数空間へ引き戻す。3. 実装コード (Python)Pythonの decimal モジュールを使用し、浮動小数点誤差を排除した100桁精度のデジタル宇宙の実装を行ってみた。

  3. 検証結果低スペックなCPU(Celeron N5105)を用い、連続演算耐久テストを実施した。演算スループット: 約 3.09 MOPS精度維持:1,000兆(15桁)をノーエラーで突破。現在、1,377兆(31桁)領域を進行中。100桁(Googol)の領域まで精度を維持する見込み。

  4. 【考察】本アルゴリズムは、既存の格子暗号ベースのFHEとは一線を画す。計算量O(N)を維持しながら秘匿演算が可能であることを示唆している。現状、総当たり攻撃に対する耐性や、多次元化による秘匿性の強化など課題はあるが、「計算機が中身を知らずに正しい答えを出す」ための極めて軽量なフレームワークとしてのポテンシャルは高い。

以下任意精度のコード

限界.py
from decimal import Decimal, getcontext
import time

# --- 精度設定 ---
# 任意精度100桁
getcontext().prec = 100

# 秘密鍵(整数として定義)
K = 1000
THETA_COS = Decimal('707')
THETA_SIN = Decimal('707')

def iut_inject(value):
    d_val = Decimal(str(value)) # 精度を保つため文字列経由で変換
    alpha = d_val * THETA_COS
    beta = d_val * THETA_SIN
    return alpha, beta

def iut_restore(alpha, beta):
    dot_product = (alpha * THETA_COS) + (beta * THETA_SIN)
    magnitude_sq = (THETA_COS**2) + (THETA_SIN**2)
    
    # 割り算をDecimalで行い整数に戻す
    res = dot_product / magnitude_sq
    return int(res.to_integral_value(rounding="ROUND_HALF_UP"))

print("実行")

current_val = Decimal('100000000') # Floatの限界9400万の少し先からスタート
step = Decimal('10000000')

try:
    while True:
        # 計算式: (x + x) * x 
        # 入力値が大きいほど掛け算の結果は爆発的に大きくなる
        a1, b1 = iut_inject(current_val)
        
        res_a = a1 + a1
        res_b = b1 + b1
        final_a = res_a * current_val
        final_b = res_b * current_val
        
        expected = (current_val + current_val) * current_val
        
        result = iut_restore(final_a, final_b)
        
        if result != expected:
            print(f"\n 限界到達")
            print(f"入力値: {current_val}")
            print(f"期待値: {expected}")
            print(f"復元値: {result}")
            print(f"桁数: {len(str(expected))}")
            break
        
        if int(current_val) % 100000000 == 0:
            print(f" {current_val:,.0f} 突破... (現在 {len(str(expected))} 桁)")
            
        current_val += step

except KeyboardInterrupt:
    print("\n 停止")

mopsとtimeを測るコード

mops_time.py
import time
from decimal import Decimal, getcontext

getcontext().prec = 100

THETA_COS = Decimal('707')
THETA_SIN = Decimal('707')

def iut_inject(value):
    d_val = Decimal(str(value))
    return d_val * THETA_COS, d_val * THETA_SIN

def iut_restore(alpha, beta):
    dot_product = (alpha * THETA_COS) + (beta * THETA_SIN)
    magnitude_sq = (THETA_COS**2) + (THETA_SIN**2)
    res = dot_product / magnitude_sq
    return int(res.to_integral_value(rounding="ROUND_HALF_UP"))

def benchmark():
    iterations = 1000000
    test_val = 123456789

    a, b = iut_inject(test_val)
    
    start = time.time()
    for _ in range(iterations):
        ra, rb = a + a, b + b
        fa, fb = ra * test_val, rb * test_val
    iut_time = time.time() - start
    
    _ = iut_restore(fa, fb)
    
    iut_mops = iterations / iut_time / 1000000

    start = time.time()
    for _ in range(iterations):
        res = (test_val + test_val) * test_val
    normal_time = time.time() - start
    normal_mops = iterations / normal_time / 1000000

    print(f"【計測対象】 (x + x) * x (暗号化状態でのループ)")
    print(f"IUT版 (宇宙内演算のみ): {iut_time:.4f} sec | {iut_mops:.2f} MOPS")
    print(f"通常計算版          : {normal_time:.4f} sec | {normal_mops:.2f} MOPS")
    print("-" * 40)
    final_res = iut_restore(fa, fb)
    print(f"精度チェック: {' PERFECT' if final_res == (test_val + test_val) * test_val else ' FAIL'}")

if __name__ == "__main__":
    benchmark()
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?