lib/ed25519_keccak/ed25519base.rb
def pow_mod(base, exponent, modulus)
      raise ArgumentError if exponent<0 || modulus<0
      # result of Nmod1 is always 0
      return 0 if modulus.equal? 1
      result = 1
      base = base % modulus
      while exponent > 0
        result = result*base%modulus if (exponent%2).equal? 1
        exponent = exponent >> 1
        base = base*base%modulus
      end
      return result
    end
def pow_mod(base, exponent, modulus)
      raise ArgumentError if exponent<0 || modulus<0
      # result of Nmod1 is always 0
      return 0 if modulus.equal? 1
      result = 1
      base = base % modulus
      while exponent > 0
        result = result*base%modulus if (exponent%2).equal? 1
        exponent = exponent >> 1
        base = base*base%modulus
      end
      return result
    end
region calculate mod 
 calculate base**exponent % modulus