Bisection/Newton algorithms

Hi everyone
I wrote an APR calculator for an ericsson T610 (don't ask why), everything works fine except it takes a really long time to run through the algorithm. (which I'm about to believe is too powerful for the handset)
I don't really know how to optimize my code to reduce the number of attempts before hitting the correct interest rate(required value)
(for those who have worked with the Bisection and Newton methods for calculating APR will know the required value progresses between a min and a max range until its at the correct value, every time a possible value is determined its used to calculate the sum of present values which in turn must equal the original advance otherwise it continues up and down the range until the correct value is found)
What I want to know really, is this type of calculation really fit for the handset, should it be able to handle the calculation, and I need to change my code?
Any ideas, direction to other forums or direction to some where use full will be greatly appreciated.
Cheerio.

Hi sabre150
I will gladly post it, just to let you know I have solved the equation (using bisection method not newton), my problem is with the speed of the process on the handset. anyway here goes...
The manual given to me can be found at
http://www.oft.gov.uk/NR/rdonlyres/19342C6E-BB3E-41E9-AA15-29054CD31D77/0/oft144.pdf
the formula is on page (pdf) 14 (in the book page 9)
on page (pdf) 54 you will find psudo code for the bisection method (in the book page 49)
on page (pdf) 57 you will find psudo code for the newton method (in the book page 52)
to save anyone from attempting alot of reading
'A' represents (future value) total sum of installments
'pV' represents (present value)
' t ' represents the term (in months)
' i ' represents the APR in bisection method
' x ' represents apr in newton method
'dV' represents derivative value
for example :
advance = 91500
term = 300 (months)
rate = 9.5%
to calculate installments use: advance * rate / ( 1 - ( 1 + rate ) ^ ( -NoOfInstallments ) )
in this case the installments are 799.4324446897131 per month
bisection method:
A = pV ( 1 + i ) ^ ( t )
Pv = A / ( 1 + i ) ^ ( t / 12)
total_pVs_for_advance = 91500 (there is just one)
using the correct value for i the total_sum_Of_pVs_for_installments will equal total_pVs_for_advance
value i will then be the apr.
the information above can be used with the psudo code from the bisection method pointed out in page (pdf) 54
the result should read 10.48......
in newton's method: unfortunatly they dont explain alot regarding the newton method
as explained in the book when using newton method it is more convenient to have the present value formula as
Ax^t . i would imagine this is read as A * ( 1 / ( 1+x ) ^ t (please correct me if i'm wrong)
x is the intermediate value and has the the value
1 / ( 1 + x )
also this method requires the calculation of a derivative value dV
which has the formula
tAx^t -1. i would imagine this is read as t * A * ( 1 / ( 1+ x )) ^ t-1 (please correct me if i'm wrong)
using the information above and the psudo code for the newton method the answer reads
10.48.......

Similar Messages

  • Quasi Newton Optimization Algorithm in Java

    I need to implement Quasi Newton Optimization Algorithm in Java, I�ve found it in C. Can anyone help me to find this in Java?

    Plagiarise in British English. Plagiarize in American English.
    These forums are used internationally, so either is reasonable.
    Don't correct other people's spelling unless you're really sure of your ground.

  • Getting Error while decrypt a file using Blowfish algorithm

    I am using blowfish algorithm for encrypt and decrypt my file. this is my code for encrypting decrypting .
    while i am running program i am getting an Exception
    Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded
    at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
    at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
    at com.sun.crypto.provider.BlowfishCipher.engineDoFinal(DashoA6275)
    at javax.crypto.Cipher.doFinal(DashoA12275)
    at Blowfishexe.main(Blowfishexe.java:65)
    import java.security.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.io.*;
    import org.bouncycastle.crypto.CryptoException;
    import org.bouncycastle.crypto.KeyGenerationParameters;
    import org.bouncycastle.crypto.engines.DESedeEngine;
    import org.bouncycastle.crypto.generators.DESedeKeyGenerator;
    import org.bouncycastle.crypto.modes.CBCBlockCipher;
    import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
    import org.bouncycastle.crypto.params.DESedeParameters;
    import org.bouncycastle.crypto.params.KeyParameter;
    import org.bouncycastle.util.encoders.Hex;
    public class Blowfishexe {
    public static void main(String[] args) throws Exception {
    KeyGenerator kgen = KeyGenerator.getInstance("Blowfish");
              kgen.init(128);
              String keyfile="C:\\Encryption\\BlowfishKey.dat";
    SecretKey skey = kgen.generateKey();
    byte[] raw = skey.getEncoded();
    SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");
              System.out.println("key"+raw);
                   byte[] keyBytes = skey.getEncoded();
                   byte[] keyhex = Hex.encode(keyBytes);
                   BufferedOutputStream keystream =
    new BufferedOutputStream(new FileOutputStream(keyfile));
                        keystream.write(keyhex, 0, keyhex.length);
    keystream.flush();
    keystream.close();
    Cipher cipher = Cipher.getInstance("Blowfish");
    cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
              System.out.println("secretKey"+skeySpec);
    FileOutputStream fos=new FileOutputStream("C:\\Encryption\\credit11.txt");
              BufferedReader br=new BufferedReader(new FileReader("C:\\Encryption\\credit.txt"));
              String text=null;
              byte[] plainText=null;
              byte[] cipherText=null;
              while((text=br.readLine())!=null)
              System.out.println(text);
              plainText = text.getBytes();
              cipherText = cipher.doFinal(plainText);
              fos.write(cipherText);
              br.close();
              fos.close();
              cipher.init(Cipher.DECRYPT_MODE, skeySpec);
              FileOutputStream fos1=new FileOutputStream("C:\\Encryption\\BlowfishOutput.txt");
              BufferedReader br1=new BufferedReader(new FileReader("C:\\Encryption\\credit11.txt"));
              String text1=null;
              /*while((text1=br1.readLine())!=null)
                   System.out.println("text is"+text1);
                   plainText=text1.getBytes("UTF8");
                   cipherText=cipher.doFinal(plainText);
                   fos1.write(cipherText);
              br1.close();
              fos1.close();
    //byte[] encrypted = cipher.doFinal("This is just an example".getBytes());
              //System.out.println("encrypted value"+encrypted);*/
    Any one pls tell me how to slove my problem
    thanks in advance

    hi
    i got the solution. its working now
    but blowfish key ranges from 56 to448
    while i am writing the code as
    KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
    keyGenerator.init(448);
    this code is generating the key upto 448 bits
    but coming to encoding or decode section key length is not accepting
    cipher.init(Cipher.ENCRYPT_MODE, key);
    Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.init(DashoA12275)
    at javax.crypto.Cipher.init(DashoA12275)
    at Blowfish1.main(Blowfish1.java:46)
    i am getting this error
    what is the solution for this type of exception.
    thank you

  • SHA2 Algorithm support in Adobe Acrobat 9

    Hello,
    1) Does Acrobat 9 supports SHA2 Hash algorithms while signing PDF file?
    2) As per my understanding PDF is signed using below approach
        Step 1. Take the PDF contents
        Step 2. Calculate the Hash of the content
        Step 3. Then sign(Encrypt) the hash. (here again we calculate the hash)
      So we are hashing the content twice.
      If I use SHA1 algorithm in Step2 and SHA2 algorithm in Step3, Adobe 9 is able to verify the signature. But if i use SHA2 algorithm in Step1 & Step 2
      Adobe 9 is saying "Content altered....."
      Why so?
    Please help.
    Thanks in advance
    Priyanka

    SHA2 was only added in Acrobat 9.1.  Also, the Microsoft Base CSP is needed for SHA2 support - Base CSP is included in Vista and Windows 7, but in XP it needs to be downloaded as a seperate addon.
    How are you setting the values in your SecurityHandler?  Off the top of my head, I believe in order to use SHA2 to hash the content (your "Step 2") you need to use AES-256 as your encryption algorithm which required a different cryptVersion be set in your SecurityHandler structure.

  • Application registration algorithm

    I'm writing a small shareware app that I would ideally like people to register. This is the classic, if they send in the registration code 'xxxxxx', then I can send the unlock code 'YYYYY' situation.
    Three criteria:
    1) I would like the registrtaion code xxxxx to be unique. I am toying with the idea of storing the date in millisecs of when the app was first run on the system. If anyone has any better suggestions, I would love to hear them.
    2) I would really like to have the algorithm myself. i.e. I don't plan to make enough off of this to be worth purchasing a library.
    3) This does not need to be incredibly secure. Just enough to keep the casual person from
    Does anyone out there have an algorithm they are willing to share to accomplish this?
    Thanks all. This falls into the 'I know it has to be a known problem, but I'm not sure where to start' category.

    Unless I am misunderstanding, I think that I'm addressing what you mentioned. Let me recap and see if I can make it more clear.
    1) Client sends you an identifier and saves it to the client's disk.
    String start = "" + System.currentTimeMillis();
    start = start.substring( start.length() - 5, start.length() );
    //this pulls off the last 6 numbers from the first run time and converts to a string. 
    // this is written to a file on the client side and then sent to me for registration.
    2) You (the server) send back a hash of the identifier.
    //registration app
    String start = codeSentFromCustomer;
    String superSecretDecoderString = "Secret Code";
    start = start + superSecretDecoderString;
    String result = MD5.getHashString( start );
    result = result.substring( result.length() - 9, result.length() );
    //this takes the 6 digits provided and appends "Secret Code".
    //  i.e. if the customer's code is "333232", then "333232Secret Code" is fed into MD5.
    //  I then send the customer the last 10 digits from my MD5 hash, say "1234567890" for simplicity sake
    3) Clients types the unlock code ("1234567890") into the registration box, which is then saved to disk.
    // to check on the unlock code's validity, I...
    String superSecretDecoderString = "Secret Code";
    String start = originalCodeFromAbove; //i.e. "333232" in this example
    start = start + superSecretDecoderString;  //now start = "333232Secret Code"
    String result2 = MD5.getHashString( start );
    result2 = result2.substring( result2.length() - 9, result2.length());
    // I compare the result2 to the stored unlock code to make sure they are equal
    //  superSecretDecoderString is stored within the client and the registration prog's code.  i.e.
    //  the customer never sees that string.
    4) At each startup the client code checks the hash of sent ID against the return he has stored.
    // run through the validation code detailed in #3.I think it addresses what you were referring to, but if it doesn't please tell me. It's my first crack at this sort of code, and I'd much rather discover any gaping holes now than later. :)
    thanks again

  • New to the Apple 'Newton' Messagepad 2100/2000 Can Some One Help?

    So I've just recently discovered the world of the Apple Messagepad. I've been searching for a while now for a pda that best suites my interests and needs. When I came across this old ad for the Messagepad I totally got excited as I love Apple products and seriously loved the look and features that the device boasted. So - now I've put some bids on a couple of 2100 models on ebay and am waiting, I've also found some resellers, I'm definitely going to get a hold of one of these devices. I've done some research on the devices and am concerned mostly with the just how difficult it will be to install software and/or upgrades onto the device from my G5 Powermac. Is there anyone out there with advice and/or suggestions for this Newton Newbie? Any info you can offer me about anything having to do with Messagepads would be surely helpful.
    Thanks.

    Welcome to the world of the Newt!
    In addition to the links already posted you will really need to look carefully at www.unna.org - specifically the wikiwikinewt which is a goldmine of information. Also after reading that if you have any questions you can post them on www.newtontalk.net.
    To get going on the install of software you have to overcome the "bootstrapping" problem (see wikiwikinewt). If you don't have access to someone with a Newt (you can then use iRDA) or can't get hold of a PCMCIA card from another Newt owner, then you will need a serial cable setup + a serial/USB adapter + a dongle for the Newt. The dongle adapts the Newt connector to the old Mac serial cable and the adapter makes it possible to connect to the latest Macs (this is what I use) (Keypsan produce a good adapter).
    Good Luck!

  • Fastest square root algorithm

    I was looking for a fast algorythm for integer square roots and I found this one http://medialab.freaknet.org/martin/src/sqrt/.
    The algorithm comes from a book by Mr C. Woo on how to do maths on an abacus.
    I post the javaized version here in case anyone finds it interesting.
    I believe this is the fastest square root function in existance for integers (and in game programming much of the time you aren't interested in fractions)
    /* Fast interger square root adapted from algorithm by Martin Guy @ UKC, June 1985.
        *   Origonally from a book on programming abaci by Mr C. Woo.
       public static int fastSqrt2(int n)
          int op, res, one;
          op = n;
          res = 0;
          /* "one" starts at the highest power of four <= than the argument. */
          one = 1 << 30;   /* second-to-top bit set */
          while (one > op) one >>= 2;
          while (one != 0)
             if (op >= res + one)
                op = op - (res + one);
                res = res +  (one<<1);
             res >>= 1;
             one >>= 2;
          return(res);
       }

    public static double sqrt(double a){
      if(a<0) throw new IllegalArgumentException("number<0");
      double precision=0.001;
      double x_nMinus1 = -1;
      double x_n = 1;
      while( Math.abs(x_n - x_nMinus1) > precision ) {
        x_nMinus1 = x_n;
        x_n = (x_nMinus1 * x_nMinus1 + a) / (2*x_nMinus1);          
      return x_n;           
    }

  • Square root algorithm?

    Okay, two things...I've always kinda wondered what the algorithm for the square-root function is...where would I find that?
    but the main thing is, I was making a class to store/deal with a complex/mixed number (a + b*i), and I was trying to make a square-root method for that. But I fiddled around with the variables in the equation, and I can't quite get any further.
    This is what I got (algebraically: this isn't actual code):
    ( the variables a, b, c, d are all real numbers )
    ( the constant i is the imaginary unit, sqrt(-1) )
    sqrt(a + b*i) == c + d*i
    a + b*i == (c + di)^2
    a + b*i == c*c - d*d + 2*c*d*i
    a == c*c - d*d
    b == 2*c*d
    c == sqrt( a + d*d )
    c == b / (2* d)
    d == sqrt( c*c - a )
    d == b / (2*c)
    right now the only thing i can conclude from that, is that if you know (a or b) and (c or d) you can determine the other variables. but I can't figure out how to define c or d purely in terms of a and b, as the method would need to. so I'm stuck.

    Okay, two things...I've always kinda wondered what the
    algorithm for the square-root function is...where
    would I find that?
    Math.sqrt()It's an extremely important skill to learn to read the API and become familiar with the tools you will use to program Java. Java has an extensive set of documentation that you can even download for your convenience. These "javadocs" are indexed and categorized so you can quickly look up any class or method. Take the time to consult this resource whenever you have a question - you'll find they typically contain very detailed descriptions and possibly some code examples.
    http://java.sun.com/reference/api/index.html
    http://java.sun.com/j2se/1.4.2/docs/api/

  • Square root of an interval using Newton's method

    Hello!
    I am trying to create a method that calculates the square root of an interval, and I am having trouble with both the actual calculation part, as well as the base case for the recursion. I implemented a simple counter for the recursion, but was not seeing any kind of pattern for the values. (I am pretty sure the "better" values should converge to 0).
    I was wondering if anybody wanted to take a swing at it and help me out. :)
    Here is the code for my program, followed by the code for Newton's method for calculating square roots of doubles. I am supposed to use it as a reference.
    I made the simple arithmetic methods with the help of http://en.wikipedia.org/wiki/Interval_arithmetic . They seem to work fine, so I am having issues with troubleshooting!
    Thanks!
    public class Interval {
         double x1;
         double x2;
         public Interval(double newx1, double newx2){
              x1 = newx1;
              x2 = newx2;
         public String toString(){
              return "[" + this.x1 + ", " + this.x2 + "]";
         //Add an interval to the current one.
         public Interval add(Interval j){
              double tempx1 = this.x1 + j.x1;
              double tempx2 = this.x2 + j.x2;
              Interval tempInterval = new Interval(tempx1, tempx2);
              return tempInterval;
         //Subtract an interval from the current one.
         public Interval sub(Interval j){
              double tempx1 = this.x1 - j.x2;
              double tempx2 = this.x2 - j.x1;
              Interval tempInterval = new Interval(tempx1, tempx2);
              return tempInterval;
         //Multiply an interval with the current one.
         public Interval mul(Interval j){
                   double minx1 = Math.min(this.x1*j.x1, this.x2*j.x2);
                   double minx2 = Math.min(this.x1*j.x2, this.x2*j.x1);
                   double maxx1 = Math.max(this.x1*j.x1, this.x2*j.x2);
                   double maxx2 = Math.max(this.x1*j.x2, this.x2*j.x1);
                   double tempx1 = Math.min(minx1, minx2);
                   double tempx2 = Math.max(maxx1, maxx2);
                   Interval tempInterval = new Interval(tempx1, tempx2);
                   return tempInterval;
         //Divide the current interval by a new one.
         public Interval div(Interval j){
                   double minx1 = Math.min(this.x1/j.x1, this.x2/j.x2);
                   double minx2 = Math.min(this.x1/j.x2, this.x2/j.x1);
                   double maxx1 = Math.max(this.x1/j.x1, this.x2/j.x2);
                   double maxx2 = Math.max(this.x1/j.x2, this.x2/j.x1);
                   double tempx1 = Math.min(minx1, minx2);
                   double tempx2 = Math.max(maxx1, maxx2);
                   Interval tempInterval = new Interval(tempx1, tempx2);
                   return tempInterval;
         static Interval step(Interval x, Interval y) {
              // Compute a "better" guess than x for the square root of y:
              // Code for doubles: Interval better = x - (x*x - y)/(2*x);
              Interval two = new Interval(2.0, 2.0);
              Interval better = x.sub( ( (x.mul(x)).sub(y) ).div(two.mul(x)) );
              // For doubles:
              if ( Math.abs(better.x2 - better.x1) < 0.001 ) { // base case
                   System.out.println(better.toString());
                   return better;
              else {
                   return step(better, y); // try to get even better...
         static Interval sqrt(Interval y) {
              return step(y, y); //: start guessing at the square root
         public static void main(String args[]){
              Interval i = new Interval(4.0, 8.0);
              Interval j = new Interval(4.0, 8.0);
              Interval addij = i.add(j);
              Interval subij = i.sub(j);
              Interval mulij = i.mul(j);
              Interval divij = i.div(j);
              Interval sqrtj = i.sqrt(j);
              System.out.println("Intervals:");
              System.out.println(i.toString());
              System.out.println(j.toString());
              System.out.println("Add: " + addij.toString());
              System.out.println("Sub: " + subij.toString());
              System.out.println("Mul: " + mulij.toString());
              System.out.println("Div: " + divij.toString());
              System.out.println("Sqrt: " + sqrtj.toString());
    }and newton's root finder for doubles:
    public class SquareRoot {
         static final double ALLOWED_ERROR = 0.001;
          * Newton's method for finding square roots.
         static double step(double x, double y) {
              // Compute a "better" guess than x for the square root of y:
              double better = x - (x*x - y)/(2*x);
              // Are we close enough?
              if ( Math.abs(x - better) < ALLOWED_ERROR ) { // => stop: base case
                   return better;
              else {
                   return step(better, y); // try to get even better...
         static double sqrt(double y) {
              return step(y, y); //: start guessing at the square root
         public static void main(String[] args) {
              System.out.println(Math.sqrt(1234));
              System.out.println(sqrt(1234));
              // NOTE: you may need to adjust the error bound for these two to agree
    }

    Nathron wrote:
    Here is the code for my program, followed by the code for Newton's method for calculating square roots of doubles. I am supposed to use it as a reference.The only thing I can see that looks suspicious is the call to step(better, y) in your reference code.
    Are you sure it shouldn't be step(y, better) or step(better, x))? Newton-Rhapson is supposed to be a progressive method, but as far as I can see the value of y can never change with the way you've got it. And if you've copied that to your new code, it might explain the problem.
    Winston

  • Fast square root algorithm

    Does anyone here know where I can find an algorithm for a faster square root method than the one provided in java.lang.Math? I've tried Google, but can't come up with anything useful...
    Thanks in advance!

    Well, these guys writing JVM's are getting they wages
    for something.
    Also, how would Java compete to C/C++ on
    computational tasks without this?So you're only guessing. You assume that the JVM has a SQRT instruction. I checked but I couldn't find any. The other possibility is that the Math library is implemented using JNI. Well it may be in some standard libraries but there's no guarantee and also remember that a JNI call carries a lot of overhead so I'm not that sure it would pay off.
    If you can guess I'm entiteled to a guess too -:) I would be very surprised if Java generally would support a hardware accelerated square root calculation. On the other hand a C++ compiler wouldn't automatically do it either.

  • Image Processing Algorithms - From Matlab to Pixel Bender

    Hello.
    Got a few Image Processing (Mainly Image Enhancement) Algorithms I created in Matlab.
    I would like to make them run on Photoshop, Create a Plug In out of it.
    Would Pixel Bender be the right way doing it?
    The Algorithms mainly use Convolutions and Fourier Domain operations.
    All I need is a simple Preview Window and few Sliders, Dropbox and Buttons.
    I'd appreciate your help.

    pixel vs float - Couldn't figure out what exactly is the difference if there is at all. I assume Pixel always get clipped into [0 1] and float won't until it gets to be shown on the screen as an output?
    There is no difference between them. At one stage of development we had some ideas about the way the pixel type should work that would make it different to float, but the ideas never came to anything and by the time we realized that it was too late to change. It's #1 on my list of "mistakes we made when developing Pixel Bender".
    Regions - Let me see if I get is straight. For the example assuming Gaussian Blur Kernel of Radius 5 (Not the STD, but the radius - a 11x11 Matrix). I should use "needed()" in order to define the support of each pixel output in the input image. I should do it to make sure no one changes those values before the output pixel is calculated.
    Now, In the documentation is goes needed(region outputRegion, imageRef inputIndex). Should I assume that at default the outputRegion is actually the sampled pixel in the input? Now I use outset(outputRegion, float2(x, y)) to enlarge the "Safe Zone". I don't get this float2 number. Let's say it's (4, 3) and the current pixel is (10, 10). Now the safe zone goes 4 pixel to the left, 4 to the right, 3 up and 3 down? I assume it actually creates a rectangle area, right? Back to our example I should set outset(outputRegion, float2(5.0, 5.0)) right?
    Needed is the function the system calls to answer the question "what area of the input do I need in order to calculate a particular area of the output?".
    I should do it to make sure no one changes those values before the output pixel is calculated.
    No, you should do it to make sure the input pixel values needed to compute the output pixel values have been calculated and stored.
    Should I assume that at default the outputRegion is actually the sampled pixel in the input?
    No. When "the system" (i.e. After Effects, PB toolkit or the Photoshop plugin) decides it wants to display a particular area of the output, it will call the needed function with that area in the outputRegion parameter. The job of the needed function is to take whatever output region it is given and work out what input area is required to compute it correctly.
    Let's say it's (4, 3) and the current pixel is (10, 10).
    Don't think in terms of "current pixel" when you're looking at the needed function. The region functions are not called on a per-pixel basis, they are called once at the start of computing the frame, before we do the computation for each pixel.
    Back to our example I should set outset(outputRegion, float2(5.0, 5.0)) right?
    Yes - you're correct. Whatever size the output region is, you require an input region that has an additional border of 5 pixels all round to calculate it correctly.

  • Ask again:  Where can I find source code for CPRM algorithm?

    Hi, everyone.
    Where can I find reference implementation or some sample codes for CPRM(content protection for recordable media) algorithm? Can anyone help?
    Information about CPRM can be find here,
    http://www.4centity.com/
    JAVA version is preferred and C/C++ implementation is also OK.
    Thanks in advance,
    Geo

    Thanks, edsonw buddy!
    I only found C2 cipher source code and some other documents dealing with CPRM algorithm. And what I want is total CPRM implementation reference source code (C2 is only a basic module of CPRM algorithm).
    So can you provide me some useful information dealing with how to get total CPRM implementation reference source code? Both JAVA and C/C++ will be OK.
    Have a wonderful weekend,
    George

  • Where can I find source code for CPRM algorithm?

    Hi, everyone.
    Where can I find reference implementation or some sample codes for CPRM(content protection for recordable media) algorithm? Can anyone help?
    Information about CPRM can be find here,
    http://www.4centity.com/
    Thanks in advance,
    Geo

    Thanks, edsonw buddy!
    I really take rather a lot of time to search reference implementation in this site but failed to find it out. Can you give me the precise link from which I can download reference implementation and sample vectors?
    Best regards,
    George

  • Lync 2013 Front End SIP/2.0 500 Compression algorithm refused

    I've deployed a brand new Lync 2013 environment hosted on Windows Server 2012 R2 that is currently in co-existence mode with my Lync 2010 environment. 
    I have SCOM 2012 monitoring the environment and it recently started reporting that one or more of my front end servers
    was in a critical state.  Diving into it revealed the following perf counter threshold was being tripped:
    Time Sampled: 3/26/2014 2:33:30 PM
    Object Name: LS:SIP - Responses
    Counter Name: SIP - Local 500 Responses
    Instance Name: 
    First Value: 14287
    Last Value: 14340
    Delta Value: 53
    Using OCSLOGGER.exe on the front end to capture logs, i trapped the following:
    TL_INFO(TF_PROTOCOL) [11]9138.1C58::03/26/2014-19:12:39.098.0022c780 (SIPStack,SIPAdminLog::ProtocolRecord::Flush:ProtocolRecord.cpp(265))[120713120] $$begin_record
    Trace-Correlation-Id: 120713120
    Instance-Id: 7D80EB
    Direction: outgoing;source="local"
    Peer: poolA.contoso.com:63820
    Message-Type: response
    Start-Line: SIP/2.0 500 Compression algorithm refused
    FROM: <sip:poolA.contoso.com>;ms-fe=FEserver1.contoso.com
    To: <sip:poolA.contoso.com>;tag=F8B88CAB38613EB380773027C56D94AF
    CALL-ID: 986f9f568c794ce39d33d7158376157b
    CSEQ: 1 NEGOTIATE
    Via: SIP/2.0/TLS 10.154.228.225:63820;ms-received-port=63820;ms-received-cid=C3D7C00
    Content-Length: 0
    ms-diagnostics: 2;reason="See response code and reason phrase";HRESULT="0xC3E93C0F(SIP_E_REACHED_CONFIGURED_LIMIT)";source="FEserver1.contoso.com"
    Server: RTC/5.0
    $$end_record
    The only recent change made to the front end servers was making the registry change outlined in this article: 
    http://support.microsoft.com/kb/2901554/en-us so i'm wondering if that has something to do with it.

    The MSFT support person said to re-apply CU5 to the Director servers and reboot.  Since this is impactful to the environment and I would have to do reboots anyway, I opted to go the route of installing the more recent update so....
    Last weekend I updated my Lync environment with what I think is considered CU6, the September 2014 updates for Lync 2013 Server (https://support.microsoft.com/kb/2809243) and still no luck. The front
    end servers are fine; no excess SIP 500 errors occurring there but within 30 minutes of removing the SCOM override on the Director servers the alerts started firing again.
    I reinstated the override in SCOM for the Directors and had my case with Premier support un-archived.  The MSFT support person said if the alerts didn't go away she was going to have to engage the Lync product group for help.  We'll see where it
    goes from here.
    JKuta

  • Compability problem with Java and Python  RSA algorithm implementation

    I have client server application. Server is writtein in python, client in java. Client receives messages from server encrypted with RSA (http://stuvel.eu/rsa), and I'm unable to decrypt it. It seems that this is RSA algorithm compatibility problem. I'm using algorithm from java.security package, instatinating Cipher object like this: c = Cipher.getInstance("RSA"); . I noticed that this algorithm produces for input blocks of lengtrh <=117 ouput block of length 128. Server I guess uses the most triviall impelentation of RSA ( (1 byte is encrypted to 1 byte) So i want to make my java algorithm compatibile with this one which server uses. How to do that ? Do i have to instatinate Cipher object in different way ? Or use another library ?

    azedor wrote:
    First you said it was no good because it could only handle <= 117 byte inputs, now you say it is no good because it produces a 128-byte output. You're not making sense.First i said that this two RSA implementations are not compatibile, and first reason i noticed firstly is that Python imlementation for input of length N produces cryptogram of the same length. Not true. In general, the RSA encryption of any number of bytes less than the length of the modulus will produce a result of length near that of the modulus. When N is less than the length of the modulus, it is rare that N bytes of cleartext produces N bytes of ciphertext.
    Java implementation for data block of length <=117 produces alwasy 128 bytes of output.Pretty much correct and very much desirable. This is primarily a function of the PKCS1 padding which is used to solve two basic problems. First, as I alluded to in my first response, it is the nature of the algorithm that leading zeros are not preserved and second when the cleartext is very small (a few bytes) the exponentiation does not roll over and it is easy to decrypt the result. Both these problems are addressed by PKCS1 padding.
    >
    >
    After what sabre150 said i think of giving up idea of translating Python code to Java and considering to use another assymetric cryptography algorithms on both sides. Can you recommend me sth what should be compatibile with Python ?This seems to be at odds with your statement in reply #3 "Also have acces only to client code so i have to change sth in java." ! This statement is why I said "I suspect ... you have dug a deep hole".
    In your position I would use the Python bindings for openssl. Once more, Google is your friend.

Maybe you are looking for

  • How can I see my Pdf's from my PC on my Smartphone?

    How can I see my Pdf,s from my Pc on my Smartphone?

  • How do I make my new Airport Extreme a base station?

    I have been using an Airport Extreme (5th generation) as my base station router for a few years. I set the main network for my and my wife's use and created a guest network for when my sons visited and needed to use the wi-fi connection. I used passw

  • Kernel panic after 10.5.8 Update

    Hi, I have the black intel Macbook which was bought slightly over a year ago. A few days ago I was prompted to do the 10.5.8 update. Software Update was doing its work and I left it running with the Macbook plugged in. About an hour later, I checked

  • Having major issues with Amazon App Store on my Passport

    I got my Passport earlier this week. I haven't been able to download any apps from the Amazon App Store. Everytime I try to download anything from the Amazon App Store, I get a "download failed" message and a popup saying "There was an error while do

  • New Nano and Compilations

    Hi all, Does anyone know if compilations can be configured in the new iPod Nano? I bought it to replace an iPod Classic and on that model this could be easily done. Thanks!