explaingit

bjtupupil/ascendfhe

Analysis updated 2026-05-18

233C++Audience · researcherComplexity · 5/5Setup · hard

TLDR

A C++ library of hardware-accelerated math operations for homomorphic encryption on Huawei's Ascend NPU chips.

Mindmap

mindmap
  root((repo))
    What it does
      Provides encryption math kernels
      Runs on Ascend NPU hardware
      Exposes ops through PyTorch
    Tech stack
      C plus plus
      CANN toolkit
      PyTorch
      torch npu
    Use cases
      Accelerate homomorphic encryption research
      Build privacy preserving AI inference
    Audience
      Researchers
      Hardware engineers
    Caveats
      No top level build file included
      Requires CANN 8.5.0 environment

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Review reference implementations of modular arithmetic kernels for homomorphic encryption.

USE CASE 2

Run modular addition, multiplication, and number-theoretic transform operators on Ascend hardware.

USE CASE 3

Verify a CANN 8.5.0 environment setup using the included Jupyter notebook.

What is it built with?

C++PyTorchCANNtorch_npu

How does it compare?

bjtupupil/ascendfhekeralots/bambuhelperactuallyaridan/linux-devmgmt
Stars233243267
LanguageC++C++C++
Setup difficultyhardmoderatemoderate
Complexity5/54/53/5
Audienceresearchergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Requires Huawei's CANN 8.5.0 toolkit and Ascend 910B hardware, no top-level build file is included.

The README does not state a license.

In plain English

AscendFHE is a library of low-level math operations designed to speed up homomorphic encryption on Huawei's Ascend NPU hardware, specifically the Atlas A2 and Ascend 910B chips. Homomorphic encryption is a type of cryptography that lets you perform computations on encrypted data without ever decrypting it, which is useful for privacy-preserving AI inference and secure cloud computing. The library provides the building-block math operations that homomorphic encryption algorithms need, implemented as hardware kernels that run directly on the Ascend accelerator. The eight operators in the library cover the core math that homomorphic encryption schemes use. These include modular addition and subtraction (arithmetic that wraps around at a fixed number), two types of modular multiplication using different algorithmic tricks (Shoup and Montgomery methods), a number-theoretic transform (a fast algorithm for polynomial multiplication used in many encryption schemes), basis conversion for a representation called RNS (Residue Number System, which splits large numbers across smaller ones for efficiency), a dot-product accumulation step, and an automorphism operation that reorders and normalizes coefficients. Each operator has its own subdirectory with the device-side kernel code and the host-side logic that prepares the data layout. Once the operator package is installed and registered, the operators are accessible from Python through PyTorch using calls like torch.ops.ascend_npu_fhe.add_mod(). The README notes that the current repository does not include a top-level CMakeLists.txt for building the full extension from scratch, so the operators cannot be called without a separately installed package. The repository is primarily useful for reviewing the source code, preparing a CANN 8.5.0 environment, and running the included Jupyter notebook to verify the environment setup. The README is written in Chinese and targets researchers and engineers working on homomorphic encryption acceleration. The project requires Huawei's CANN toolkit version 8.5.0 and the matching 910B operator package. Python integration is done through PyTorch combined with torch_npu, Huawei's PyTorch extension for Ascend hardware.

Copy-paste prompts

Prompt 1
Explain what the number-theoretic transform operator in this library is used for.
Prompt 2
Walk me through setting up a CANN 8.5.0 environment to test these operators.
Prompt 3
What is the difference between the Shoup and Montgomery modular multiplication methods here?
Prompt 4
Help me understand how RNS basis conversion is implemented in this codebase.

Frequently asked questions

What is ascendfhe?

A C++ library of hardware-accelerated math operations for homomorphic encryption on Huawei's Ascend NPU chips.

What language is ascendfhe written in?

Mainly C++. The stack also includes C++, PyTorch, CANN.

What license does ascendfhe use?

The README does not state a license.

How hard is ascendfhe to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is ascendfhe for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.