编程资料集中营
 | 网站首页 | 文章中心 | 编程资料2 | 软件下载 | BT下载 | 八卦星闻 | 音乐在线 | 在线游戏 | 免费电影 | 给我留言 | 
一个简单的RSA算法实现JAVA源代码-Java技术
          ★★★
【字体:
一个简单的RSA算法实现JAVA源代码-Java技术 进入问吧

本站地址:http://www.bajiao123.com

作者:admin    文章来源:网络    点击数:    更新时间:2006-12-27    
p;
                    }
                   
                    /*if (toFile.length != ((blockSize / 8) + 1)){
                        temp = new byte[(blockSize / 8) + 1];
                        System.out.println(toFile.length + " x " + temp.length);
                        for (int i = 1; i < temp.length; i++) {
                            temp[i] = toFile[i - 1];
                        }
                        toFile = temp;
                    }
                    else
                        System.out.println(toFile.length + " " + ((blockSize / 8) + 1));*/
                    os.write(toFile);
                }
            }
        }
        catch (IOException e1) {
            System.out.println("Something went wrong");
        }
       
        /**
         * close data streams
         */
        try {
            os.close();
            reader.close();
        }
        catch (IOException e1) {
            System.out.println("Error closing file.");
        }
    }
   
    /**
     * Performs <tt>base</tt>^<sup><tt>pow</tt></sup> within the modular
     * domain of <tt>mod</tt>.
     *
     * @param base the base to be raised
     * @param pow the power to which the base will be raisded
     * @param mod the modular domain over which to perform this operation
     * @return <tt>base</tt>^<sup><tt>pow</tt></sup> within the modular
     * domain of <tt>mod</tt>.
     */
    public BigInteger encodeDecode(BigInteger base) {
        BigInteger a = ONE;
        BigInteger s = base;
        BigInteger n = myKey;
       
        while (!n.equals(ZERO)) {
            if(!n.mod(TWO).equals(ZERO))
                a = a.multiply(s).mod(myMod);
&nbs

上一页  [1] [2] [3] [4] 下一页

   

进入问吧

一个简单的RSA算法实现JAVA源代码-Java技术

本站地址:http://www.bajiao123.com

文章录入:admin    责任编辑:admin 
高级搜索
编程资料集中营