• proth01 Trailer

    From Richard Outerbridge@21:1/5 to All on Sun May 14 08:03:54 2017
    Proth01 for the HP16C v1 2013-05-12

    R0 - 1e17
    R1 - 1e18
    R2 - multiplier (18 digits, msd & lsd != 0)
    R3 - multiplicand (18 digits, msd & lsd != 0)
    R4 - modulus (0 : 769; 1 : 7937)
    R5 - plain/cipher text

    Line LBL Keys Display Comments

    001 0 LBL 0 43,22,0
    002 HEX 23
    003 UNSGN 42,3
    004 0 0
    005 WSIZE 42 44
    006 (*) 1 1 /* PRC: PReCision in Digits (hex) */
    007 2 2
    008 STO I 44 32
    009 1 1
    010 1 LBL 1 43,22,1
    011 STO 0 44 0
    012 A A
    013 * 20
    014 DSZ 43 23
    015 GTO 1 22 1
    016 STO 1 44 1
    017 DEC 24
    018 R/S 31 /* multiplier (18), ENTER */
    019 HEX 23 /* multiplicand (19), R/S */
    020 ENTER 36
    021 ENTER 36
    022 1 1
    023 AND 42 20 /* last digit of Mpd mod2 = mod */
    024 STO 4 44 4
    025 R|v 33
    026 A A
    027 / 10
    028 STO 3 44 3 /* actual modless Mpd */
    029 X-Y 34
    030 STO 2 44 2
    031 0 0
    032 A LBL A 43,22,A /* main input loop */ 033 R/S 31
    034 F F
    035 F F
    036 X-Y 34
    037 X>Y 43 3
    038 GTO A 22 A /* input greater than FF; ignore */
    039 STO 5 44 5
    040 5 LBL 5 43,22,5 /* try again */
    041 RCL 3 45 3
    042 RCL 2 45 2
    043 DBLx 43 20
    044 RCL 0 45 0
    045 DBL/ 43 10
    046 RCL 1 45 1
    047 X>Y 43 3 /* need to reduce product? */
    048 GTO 2 22 2 /* nope */
    049 CLx 43 35
    050 A A
    051 / 10 /* keep reduced product in y */
    052 ENTER 36
    053 2 LBL 2 43,22,2
    054 X-Y 34
    055 STO 3 44 3 /* update multiplicand */
    056 RCL 4 45 4
    057 X=0 43 40 /* mod 769? */ 058 GTO 3 22 3
    059 X-Y 34 /* get multiplicand back */
    060 1 1
    061 F F
    062 0 0
    063 1 1
    064 RMD 42 9 /* possible key */
    065 1 1
    066 F F
    067 0 0
    068 0 0
    069 X!=Y 43 0 /* just not that one */ 070 GTO 4 22 4 /* OK */
    071 0 0
    072 STO 4 44 4 /* switch mods */
    073 GTO 5 22 5 /* try again */
    074 3 LBL 3 43,22,3 /* mod 769 */
    075 X-Y 34 /* get multiplicand back */
    076 3 3
    077 0 0
    078 1 1
    079 RMD 42 9 /* possible key */
    080 3 3
    081 0 0
    082 0 0
    083 X!=Y 43 0 /* except that one */ 084 GTO 4 22 4 /* OK */
    085 1 1
    086 STO 4 44 4 /* switch mods */
    087 GTO 5 22 5 /* try again */
    088 4 LBL 4 43,22,4
    089 X-Y 34 /* where did that key go? */
    090 2 2
    091 0 0
    092 0 0 /* that's 512 */
    093 X-Y 34 /* actual key */
    094 - 30
    095 RCL 5 45 5 /* next input */
    096 - 30
    097 F F
    098 F F
    099 AND 42 20 /* and we're done */
    100 ISZ 43 24
    101 GTO A 22 A /* for now */
    102 F LBL F 43,22,F
    103 RCL I 45 32
    104 DEC 24
    105 R/S 31
    106 CLR REG 42 34
    107 FLOAT 2 42,45,2
    108 CLx 43 35
    109 RTN 43 21 /* optional */

    ===================================================================
    109/p3r13

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)